Shell script qui ne fonctionne pas

Bonjour,

Voilà, j'ai un serveur dédié sous ovh sous centos 5.2

Dan le crontab je lui rajoute:

[code]
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

DATE=$(date +%d-%m-%Y-%H-%M)

57 10 * * * root tar -czvf /var/www/vhosts/portailinterim.com/httpdocs/piSources'date | awk '{printf $1$2$3}''.tar.gz /var/www/vhosts/portailinterim.com/httpdocs/* # marche

22 12 * * * root tar -czvf /var/www/vhosts/portailinterim.com/httpdocs/piSources'date | awk '{print daynum($1, $2, $3)}''.tar.gz /var/www/vhosts/portailinterim.com/httpdocs/* # ne marche

00 13 * * * root run-parts /etc/archivePi.sh # ne marche
05 13 * * * root /etc/archivePi.sh # ne marche
10 13 * * * root archivePi.sh # ne marche

28 11 * * * root tar -czvf /var/www/vhosts/vhosts/portailinterim.com/httpdocs/piSources'date +%d%m%y'.tar.gz /var/www/vhosts/portailinterim.com/httpdocs/* # marche

22 4 * * 0 root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
*/1 * * * * root /usr/local/rtm/bin/rtm 7 > /dev/null 2> /dev/null

/code

J'aimerai qu'il m'exécute le fichier archivePi.sh mais rien n'y fait ça ne marche pas

Voici ce que j'ai archivePi.sh:

[code]#!/bin/bash
# Script de sauvegarde des données située sur un serveur OVH

# Compression des données
cd /var/www/vhosts/site.com/httpdocs

tar -czvf /var/www/vhosts/site.com/httpdocs/piSources1.tar.gz /var/www/vhosts/site.com/httpdocs/*
/code

Je ne vois pas du tout ou ça coince... merci d'avance pour votre aide!

6 réponses

  1. Contributeur
    Salut,

    'date | awk '{print daynum($1, $2, $3)}''
    C'est quoi ce truc? D'où ça sort ? Ça ne m'a pas l'air d'être une fonction intégrée de awk, si ?

    $ date | awk '{print daynum($1, $2, $3)}'
    awk: (FILENAME=- FNR=1) Fatal: fonction « daynum » non définie

    ;-((
    0
    1. non non ça ne fonctionne pas
      0
      1. Contributeur
        Je vais reformuler ma question : Est-ce que le(s) script(s) marche(nt) en dehors de la crontab ?
        0
    2. oui ces deux scripts fonctionnent:

      cd /var/www/vhosts/site.com/httpdocs

      tar -czvf /var/www/vhosts/site.com/httpdocs/piSources1.tar.gz /var/www/vhosts/site.com

      en utilisateur root
      0
      1. Contributeur
        Ok.

        Je réitère ma demande :

        'date | awk '{print daynum($1, $2, $3)}''
        C'est quoi ce truc? D'où ça sort ? Ça ne m'a pas l'air d'être une fonction intégrée de awk, si ?
        Cette commande renvoie quoi chez toi ?

        Ensuite, rajoute des traces dans tes crons :

        00 13 * * * root run-parts /etc/archivePi.sh >/tmp/fichier1.log 2>&1 
        05 13 * * * root /etc/archivePi.sh >/tmp/fichier2.log 2>&1 
        10 13 * * * root archivePi.sh >/tmp/fichier3.log 2>&1


        Édit : Correction 2&>1 en 2>&1

        Zen my nuggets ;-)
        0
        1. 'date | awk '{print daynum($1, $2, $3)}'' ne fonctionne pas.

          Et j'ai toujours pas de changement et rien dans les logs
          0
          1. Contributeur
            Oups ;-[

            C'est : >/tmp/fichier1.log 2>&1
            Et non pas 2&>1
            Comme je l'ai écrit précédemment ;-(

            Désolé ;-(
            0