0

I wrote a simple script that is basically apt-get update, upgrade, autoremove and autoclean, like this:

apt-get check && apt-get update && apt-get upgrade && apt-get autoremove && apt-get autoclean

I put this into my crontab, opening the tab with sudo

0 24 * * * /home/ubuntu/script.sh

Would this make the script run every 24 hours? Or would it not work? I'm asking for educational purposes, I'm not looking for more efficient ways just yet.

2
  • 1
    The script will run...but it will hang. apt-get update without the '-y' flag asks for user input. The next morning, when you kill the stuck headless process, also remember to release the apt lockfile since apt could not. (the lockfile simply makes sure that a maximum of one instance of apt can be running at a time).
    – user535733
    Oct 17, 2018 at 22:11
  • VTC As too broad because OP doesn't have a specific problem to solve. It's almost like fishing or throwing something into the wind to see if something might be a problem for someone else some place else. Oct 18, 2018 at 0:02

1 Answer 1

1

Regardless of what script you are trying to run, your crontab entry will not work.

24 is not a valid entry for the hours field. It accepts 0 - 23, where 0 is midnight.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .