I want to use crontab to run a script for yum updates. The problem is it seems it will run the script once, then yum is just stuck for a while (and can't be ran again). I get this error:
$ sudo yum update
Existing lock /var/run/yum.pid: another copy is running as pid 5248.
Another app is currently holding the yum lock; waiting for it to exit...
The other application is: yum
Memory:...
Started:... 5 day(s) ago...
State: Sleeping, pid: 5248
This is what I place in crontab:
$ sudo crontab -e
0 4 * * *
/usr/local/bin/yum_updates.sh
This is what's in the script:
$ sudo vim /usr/local/bin/yum_updates.sh
#!/bin/bash
yum makecache
yum -y update
yum -y upgrade
mandb
I considered yum-cron, but I've looked over the config file and it doesn't seem as customizable as crontab (i.e. I can't run security updates one day and full updates a different day), but correct me if I'm wrong, I haven't used yum-cron that much.
I would like to know how to stop this error, so I can run scripts using crontab without it holding the program hostage or getting the process stuck after only running once.