I want to start a blocking server in a screen on reboot, so that I may access it later.
The command screen -d -m /home/dataserv/www/start_production_server.sh
works on its own just fine regardless from where its called, but does not if used as a crontab entry.
dataserv@dataserv-dev:~$ crontab -l
# m h dom mon dow command
@reboot echo "test" > /home/dataserv/reboot.txt 2>&1
@reboot screen -d -m /home/dataserv/www/start_production_server.sh
The test entry works fine so I'm quite puzzled as to why its failing.
/usr/bin/screen
instead of justscreen
)?-L
option (before -d
, for instance), screen will log output into the cron user's home directory (perhaps yours), naming the filescreenlog.0
. If you need more debugging help, turning on the script trace (e.g.,#!/bin/sh -x
at the top) might help. Since you haven't posted the server script, there's really not enough information to do more than suggest ways for you to solve your problem.