Mailinglist Archive: opensuse (3729 mails)
| < Previous | Next > |
Re: [SLE] How do I make a bash script?
- From: Anders Johansson <andjoh@xxxxxxxxxx>
- Date: 01 Jun 2003 13:12:18 +0200
- Message-id: <1054465938.15169.5.camel@xxxxxxxxxxxxxxxxx>
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.
> 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.
| < Previous | Next > |