Jump to content

Ubuntu script problem

Wadzinsky
Go to solution Solved by Wadzinsky,

Ok,  after literally days of searching, (even before posting this), I came across a forum that addresses my issue.  Here is the solution if anyone else has this particular problem running snaps in cron.  

 

Add the following line to the top of the root crontab

 

PATH=snap/bin:/usr/bin:/bin

 

This is apparently a bug in Ubuntu 18.04 that may have been patched in later versions where the path to snap was not included in crontab.  Adding this line will allow crontab to run snaps now.  This has completely solved my issue and now my bash script runs flawlessly in crontab

 

I have a home media server that I am having an issue trying to run a script through cron.  Running the script as root in terminal works flawlessly, however when trying to run it through crontab (as root crontab) it does not work at all

 

The script runs a snap program in screen, then checks to verify in screen if the app is running.  If the app isn't running, it uninstalls and re-installs the snap program and tries to run it again.  Once verified the app is running, the bash script terminates.

 

There is a very isolated problem when recovering the boot drive from a backup image, this one particular snap will not work since the files in that folder somehow don't get recovered.  It's not a huge issue to manually re-install this snap, but I love to tinker and want to try to fully automate this process in the event I would have to recover again. 

 

Thanks,

 

Daryl

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

Ok,  after literally days of searching, (even before posting this), I came across a forum that addresses my issue.  Here is the solution if anyone else has this particular problem running snaps in cron.  

 

Add the following line to the top of the root crontab

 

PATH=snap/bin:/usr/bin:/bin

 

This is apparently a bug in Ubuntu 18.04 that may have been patched in later versions where the path to snap was not included in crontab.  Adding this line will allow crontab to run snaps now.  This has completely solved my issue and now my bash script runs flawlessly in crontab

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×