Sample Header Ad - 728x90

I have made a startup script but it only can run as an user, not root, how can I make it work?

1 vote
1 answer
50 views
there are 4 scripts that should be started after reboot as user "appian": - /opt/appian/appian_home/services/bin/start.sh -p Password -s all - /opt/appian/appian_home/data-server/bin/start.sh - /opt/appian/appian_home/search-server/bin/start.sh - /opt/appian/appian_home/tomcat/apache-tomcat/bin/start-appserver.sh Here is some code
#!/bin/bash

# Log file for debugging
    LOG_FILE="/var/log/appian_services_start.log"

# Start services and log the process
    echo "Starting Appian services: $(date)" >> $LOG_FILE

# Script 1: Start services with credentials
    /opt/appian/appian_home/services/bin/start.sh -p Password -s all >> $LOG_FILE 2>&1
    echo "Service 1 started: services/bin/start.sh" >> $LOG_FILE

# Wait for 30 seconds
    sleep 30

# Script 2: Start data-server
    /opt/appian/appian_home/data-server/bin/start.sh >> $LOG_FILE 2>&1
    echo "Service 2 started: data-server/bin/start.sh" >> $LOG_FILE

# Wait for 10 seconds
    sleep 10

# Script 3: Start search-server
    /opt/appian/appian_home/search-server/bin/start.sh >> $LOG_FILE 2>&1
    echo "Service 3 started: search-server/bin/start.sh" >> $LOG_FILE

# Wait for 10 seconds
    sleep 10

# Script 4: Start Tomcat server
    /opt/appian/appian_home/tomcat/apache-tomcat/bin/start-appserver.sh >> $LOG_FILE 2>&1
    echo "Service 4 started: tomcat/apache-tomcat/bin/start-appserver.sh" >> $LOG_FILE

    echo "All services started successfully: $(date)" >> $LOG_FILE
                                                                                 
# These are the manual steps what works 
    dzdo su - appian /opt/appian/appian_home/services/bin/start.sh -p Password -s all
    dzdo su - appian /opt/appian/appian_home/data-server/bin/start.sh
    dzdo su - appian /opt/appian/appian_home/search-server/bin/start.sh
    dzdo su - appian /opt/appian/appian_home/tomcat/apache-tomcat/bin/start-appserver.sh`
How to arrange the startup script that after a reboot the scripts can be excecuted by the appian user?
Asked by Arjun S (11 rep)
Nov 26, 2024, 01:54 PM
Last activity: Dec 1, 2024, 04:21 PM