Hello sir,
Not sure how this should get classified, it isn't really a 'bug' with any of your code, but perhaps some documenting of more prerequisites for users wanting to use cron entries, at least on some systems.
I noticed the following behavior under Ubuntu-14.04.1-LTS-64bit
When setting up cronjobs for the user, the PATH environment is bare for scripts called via cron. The instance of 'tf2server monitor' was always outputting "Tmux is not installed' messages to my logs and then attempting to restart, even though tmux is installed (/usr/local/bin/tmux) and the server was running. A quick test showed me that the PATH under cron was only '/usr/bin:/bin', which is quite bare, when the Ubuntu tmux package is installed to /usr/local/bin
The solution I took was when setting up the cron entries, to set the PATH at the top of the crontab file.
So, my crontab entries are now looking like this:
USER=tf2server
PATH=/home/tf2server/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
0 5 * * * /home/tf2server/tf2server update-restart > /dev/null 2>&1
*/5 * * * * /home/tf2server/tf2server monitor > /dev/null 2>&1
I suppose setting PATH inside the tf2server script would also work, but since this issue is more of a system related item, I think fixing it in crontab is better than changing the tf2server script unnecessarily. Perhaps some extra documentation .. or a test for tmux that will write out full path to tmux into the fn calls?
Hello sir,
Not sure how this should get classified, it isn't really a 'bug' with any of your code, but perhaps some documenting of more prerequisites for users wanting to use cron entries, at least on some systems.
I noticed the following behavior under Ubuntu-14.04.1-LTS-64bit
When setting up cronjobs for the user, the PATH environment is bare for scripts called via cron. The instance of 'tf2server monitor' was always outputting "Tmux is not installed' messages to my logs and then attempting to restart, even though tmux is installed (/usr/local/bin/tmux) and the server was running. A quick test showed me that the PATH under cron was only '/usr/bin:/bin', which is quite bare, when the Ubuntu tmux package is installed to /usr/local/bin
The solution I took was when setting up the cron entries, to set the PATH at the top of the crontab file.
So, my crontab entries are now looking like this:
I suppose setting PATH inside the tf2server script would also work, but since this issue is more of a system related item, I think fixing it in crontab is better than changing the tf2server script unnecessarily. Perhaps some extra documentation .. or a test for tmux that will write out full path to tmux into the fn calls?