I need to run a script at startup, the script needs to run under a certain user, not as root, i tried adding the script to /etc/rc.local like this:
#!/bin/sh -e
#
# rc.local
#
#!/bin/sh
su - tue -c "/home/tue/main"
su - tue -c "/opt/craftbukkit/start.sh"
The first line starts a program main in /home/tue, this is working fine. The second line is my script, but for some reason this isn't being run?
Best Answer
Take into account that:
second command could only start when the first terminates (or go to background);
-e
option will stop the execution if a command returns a nonzero exit code.