Thread: little shell script

little shell script

From
Elielson Fontanezi
Date:
Hi folks!

    Who can help me about the simple shell scripts that follows?

[root@pg_server cron.daily]# cat /etc/cron.daily/dump
#!/bin/bash

if [ -d /usr/local/pgsql/backup/ffd ]; then
   rm -rf /usr/local/pgsql/backup;
   mkdir /usr/local/pgsql/backup;
else
   mkdir /usr/local/pgsql/backup;
fi

/usr/local/pgsql/bin/pg_dump -Fp -v -s -c -X use-set-session-authorization
-d fo
rmacao_funcionario_des -f ffd.sql >> /usr/local/pgsql/backup/ffd.logsql 2>&1

if [ $? -ne 0 ]; then
   echo "**************** ERRO: pg_dump " >>
/usr/local/pgsql/backup/ffd.logsql
fi
[root@pg_server cron.daily]# crontab -u zakal /etc/cron.daily/dump
"./dump":2: bad minute
errors in crontab file, can't install.
[root@pg_server cron.daily]#

    Who can explain what of this error?

..............................................
A Question...
Since before your sun burned hot in space and before your race was born, I
have awaited a question.

Elielson Fontanezi
DBA Technical Support - PRODAM
+55 11 5080 9493



Re: little shell script

From
strange@nsk.yi.org
Date:
Uuuuh! So many To:....

On Thu, Jul 25, 2002 at 03:33:49PM -0300, Elielson Fontanezi wrote:
> Hi folks!
>
>     Who can help me about the simple shell scripts that follows?

Do you want help with the script or installing it in CRON?

Assuming the later:

> [root@pg_server cron.daily]# crontab -u zakal /etc/cron.daily/dump
> "./dump":2: bad minute
/etc/cron.daily/ contains scripts to be run daily, not crontabs.

crontab is used to edit or install a user crontab, which is in the form:
0 * * * * run_script_every_hour.sh
0 */4 * * * run_script_every_four_hours.sh
* 4 * * * run_script_every_day_at_4_o_clock.sh

$ man 5 crontab # has the description of the format and more examples

So you should just leave the script as it is in /etc/cron.daily/ to be run
as root every day, or if you need it to be run as some other user, put the
script in the user's home directory and install a proper line to that
user's crontab.

Regards,
Luciano Rocha

--
Consciousness: that annoying time between naps.