Can you run bash from command line but not crontab?

Can you run bash from command line but not crontab?

Click here for more info. bash script works from command line but not crontab? The following works fine from the command line but fails when I attempt running it either as a CGI or from crontab. My preference would be to run it as a CGI. The error is that connections to any other than the machine it is running on fail.

Why is cron job not running with same user?

The cron job doesn’t run with the same user with which you are executing the script manually – so it doesn’t have access to the same $PATH variable as your user which means it can’t locate the Java executable to execute the commands in the script. We should first fetch the value of PATH variable as below and then set it (export) in the script –

Why does my Cron script run as root?

IIRC if you put your cron script in /etc/cron.daily, cron.monthly or cron.hourly, it runs as root and ssh is usually configured to deny root logins. That could be the reason for your Permission Denied errors. Ok. There is only one key pair present in ~/.ssh/ on the machine running the cron job.

Is it possible to run bash from command line?

Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use. Exclusive for LQ members, get up to 45% off per month. Click here for more info. bash script works from command line but not crontab?

What to do if bash script is not running?

Do crontab -e for whichever crontab you’re using and replace it with output of the above command. This should mirror most of your environment in case there is some missing path issue or something else. Also check logs for any errors it’s getting.

Why is my cron job not running on my computer?

The usual causes for cron jobs to not run are permissions and paths. Please read the cron man entry a few times and try to understand how paths break and what permissions the cron job will run under.