install.sh clears user's entire crontab
kvz opened this issue · 2 comments
kvz commented
install.sh clears user's entire crontab
philcryer commented
Thynix commented
This still happens if install.sh is run as root. This is because it sets the target user's crontab to the current user's crontab with the line appended. The target user's contab may disappear or otherwise be modified in unexpected ways if the current user is root.
(crontab -l; echo "$newcronjob") | crontab -u $username - #list crontab, read entry from crontab, add line from stdin to crontab
should therefore be
(crontab -u $username -l; echo "$newcronjob") | crontab -u $username - #list crontab, read entry from crontab, add line from stdin to crontab