I created a startup script that is supposed to execute 4 other scripts after a reboot.
These scripts can be executed manually if I use dzdo su - appian and then run the scripts, but it doesn’t work when triggered by the startup process. The scripts need to be executed by the appian user.
So when I log in as root, and then do a dzdo su - appian and run these scripts it works
dzdo /opt/appian/appian_home/services/bin/start.sh -p Password -s all
dzdo /opt/appian/appian_home/data-server/bin/start.sh
dzdo /opt/appian/appian_home/search-server/bin/start.sh
dzdo /opt/appian/appian_home/tomcat/apache-tomcat/bin/start-appserver.sh
This is the systemd configuration I created:
# startup script
[Unit]
Description=Start Appian Services a`your text`fter reboot
After=network.target
[Service]
Type=oneshot
User=appian
ExecStart=/opt/scripts/start_appian_services.sh
[Install]
WantedBy=multi-user.target
bash
#!/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 /opt/appian/appian_home/services/bin/start.sh -p Password -s all
dzdo /opt/appian/appian_home/data-server/bin/start.sh
dzdo /opt/appian/appian_home/search-server/bin/start.sh
dzdo /opt/appian/appian_home/tomcat/apache-tomcat/bin/start-appserver.sh`
but it doesn't work, what am I doing wrong?
how to arrange the startup script that after a reboot the scripts can be excecuted by the appian user.