How do I make a bash script?
I would like to have apt-get update automatically. The only way I can see to do this is to set up a bash script and use cron to do it...I think. 1. What should my script look like? 2. What should I put in my crontab to make it update on a weekly basis? Since it's automatically done and needs to be done as root, how do I accomplish this? How many cups of milk do I add to my pancake mix...sorry, got carried away. Thanks, Tom - - - - - - - - - - - - - - - - - - Tom Nielsen Neuro Logic Systems, Inc. 805.389.5435 x18 www.neuro-logic.com
On Sun, 2003-06-01 at 07:54, Tom Nielsen wrote:
I would like to have apt-get update automatically. The only way I can see to do this is to set up a bash script and use cron to do it...I think.
1. What should my script look like?
As with every other bash script, it follows the general structure #!/bin/bash command_1 command_2 command_3 ... In your case it would probably be something like #!/bin/bash /usr/bin/apt-get update /usr/bin/apt-get upgrade
2. What should I put in my crontab to make it update on a weekly basis?
0 0 * * Mon root /path/to/your/script will run the script every Monday at midnight. Note that both in the script and in the crontab you should put the full path to all commands you use.
Since it's automatically done and needs to be done as root, how do I accomplish this?
The sixth field in the system crontab sets the user it should run as.
participants (2)
-
Anders Johansson
-
Tom Nielsen