Need some help with crontab
-
@dustinb3403
Maybe its something to do with the mailto variable. -
I just changed the job to include my username. We'll see how that goes.
-
@black3dynamite said in Need some help with crontab:
@dustinb3403
Maybe its something to do with the mailto variable.I don't think that is the issue, as I didn't add that. The only part I added was the command.
I configured this to run at 11AM EST (16:00 UTC) and will report back a few minutes.
-
@dustinb3403 /usr/bin/php isnt a user. I think you need to quote up.
-
@momurda said in Need some help with crontab:
@dustinb3403 /usr/bin/php isnt a user. I think you need to quote up.
So ?
@weekly "/usr/bin/php" "/var/www/html/snipeit/artisan snipeit:expiring-alerts"
-
@dustinb3403 said in Need some help with crontab:
"/usr/bin/php" "/var/www/html/snipeit/artisan snipeit:expiring-alerts"
trying this
10 16 * * 1 "/usr/bin/php" "/var/www/html/snipeit/artisan" "snipeit:expiring-alerts"
-
That didn't work. . .
-
@dustinb3403 said in Need some help with crontab:
That didn't work. . .
Have you tried that command under root crontab?
-
@black3dynamite said in Need some help with crontab:
@dustinb3403 said in Need some help with crontab:
That didn't work. . .
Have you tried that command under root crontab?
Stepping into su and running the command words.
su root > pass /usr/bin/php /var/www/html/snipeit/artisan snipeit:expiring-alerts
So this has to be with the way I have it configured. I wonder if I need to create a bash script, and simply have cron call that rather than using the lines like above in cron. . .
If I do then the documentation is misleading. . .
-
I've created a simple script and have cron set to run the script at 11:35AM. So I'll see if that works.
Executing the script from SSH works without issue. . .
So we'll see. . .
-
Ok and that is what it was.
Simply needed to make a bash script out of it and have it scheduled to run, rather than using the commands directly in cron.
Problem solved.
Solution:
pwd /usr/bin/local touch expiring-alert.sh vi expiring-alert.sh /usr/bin/php /var/www/html/snipeit/artisan snipeit:expiring-alerts sudo vi /etc/crontab 35 * * * 1 <user> /usr/local/bin/expiring-alert.sh
Presumably changing this to be
@daily
or@weekly
would work as well. -
@dustinb3403 said in Need some help with crontab:
Ok and that is what it was.
Simply needed to make a bash script out of it and have it scheduled to run, rather than using the commands directly in cron.
Problem solved.
Solution:
pwd /usr/bin/local touch expiring-alert.sh vi expiring-alert.sh /usr/bin/php /var/www/html/snipeit/artisan snipeit:expiring-alerts sudo vi /etc/crontab 35 * * * 1 <user> /usr/local/bin/expiring-alert.sh
Presumably changing this to be
@daily
or@weekly
would work as well.MOst of the time that is how I have it setup on my crontab, same for my certbot scripts too.