I have started a crontab job at reboot using the following command:
@reboot /opt/myapp/autostart_hub.sh
The file "autostart_hub.sh" has the following single-line command:
screen -d -m -S hub /opt/hubb/hub --conf /opt/hubb/hub_conf.yaml
The program, hub, is working correctly. However, I am not able to re-attach to the screen. Even when I execute:
screen -ls
as root or normal user (user1), it says:
No Sockets found in /var/run/screen/S-root.
No Sockets found in /var/run/screen/S-user1.
OS: UBUNTU 14.04
Thank you in advance.
Let screen know where you want the sockets to be placed. Seems like the environment from which you are calling (cron) differs from the one after login (missing/different HOME, I suppose). Add the following at the beginning of your /opt/myapp/autostart_hub.sh script:
export SCREENDIR=/var/run/screen/S-root
Now you should be able to reconnect detached screens in a convenient way.
You can also direct screen to look for sockets in a different directory upon reconnect:
# SCREENDIR=/.screen -r