1

I have ubuntu server with crontab that is supposed to run mkdocs in tmux at reboot. Worth noting is that I configure crontab by going into crontab -e. Line is:

@reboot /usr/bin/tmux new-session -d -s "MKDOCS" "cd /root/mkdocs && mkdocs serve -a 192.168.0.10:8080"

However, nothing happens.

I have tried just /usr/bin/tmux new-session -d -s "MKDOCS" "cd /root/mkdocs && mkdocs serve -a 192.168.0.10:8080" and it runs fine. What can be the reason? Thanks

Perovic
  • 21
  • 1
  • 1
    Does this answer your question? [Why is my crontab not working, and how can I troubleshoot it?](https://serverfault.com/questions/449651/why-is-my-crontab-not-working-and-how-can-i-troubleshoot-it) – Gerald Schneider Jan 10 '22 at 12:00
  • 1
    As described in the linked Q&A fairly common are missing newlines on the last entry of a crontab file and relying on relative path names for commands that do not live in the very limited `$PATH` used by cron. - On a different note: most sysadmins prefer services that actually run as a service rather than in tmux/screen session. – Bob Jan 10 '22 at 12:57
  • @GeraldSchneider There is no mention of the reboot option on that page. – Perovic Jan 10 '22 at 14:31
  • @Bob the path shouldn't be an issue, if you notice I am running commands with full path. ( example instead of Tmux I am running /usr/bin/tmux). I know but this is a temporary solution and there are reasons I am doing it this way, however the corn doesn't seem to do anything at reboot. – Perovic Jan 10 '22 at 14:32
  • So, you did check that it works when you enter an actual time instead of @reboot? – Gerald Schneider Jan 10 '22 at 14:36

0 Answers0