phvt wrote:
Edit: Need more coffee. You even used sudo

And I needed some much needed sleep; forgot to put the command in quotes after using su user -c. (no wonder it wouldn't quite work)
Alucard wrote:
In the user's crontab:
Code:
@reboot screen -d -m command-name
Quote:
-d -m Start screen in "detached" mode. This creates a new session but doesn’t attach to
it. This is useful for system startup scripts.
That @reboot may be version-specific, if it doesn't work then create a script in /etc/rcX.d
perfect that is what i needed; used
Code:
screen -d -m -S name su user -c "/home/user/dir/startserver.bash"
Now I just have one more question, when I start the server it is in the foreground waiting for commands; however, there are a few more lines in the script that I need executed, but they will only execute after the server is stopped (gets out of the foreground).
The rest of the script will run if I start the server in the background by using "command &", but this kills the point of running the server in a separate screen.
Basically, after the server starts i pull the pid and write it to a file, then i use that file to check the status and stop the server. So that part of the script needs to be run after the server starts.
Can't use bg/fg b/c I don't want to stop the process.
What would you think is the best way to do this?