Projet

Général

Profil

Paste
Télécharger (324 octets) Statistiques
| Branche: | Révision:

root / bin / log.sh @ 81b16cc2

1 5a1949a4 Julien Enselme
#!/bin/sh
2
. /home/assos/bin/scripts-config.sh
3
4 653aeb8e Julien Enselme
# Read stdin (so stdout from the command passed in argument)
5 5a1949a4 Julien Enselme
log=$(cat)
6 e451b022 Julien Enselme
command="$1"
7 5a1949a4 Julien Enselme
8
current_day=$(date "+%Y-%m-%d")
9 e451b022 Julien Enselme
current_time=$(date "+%H-%M-%S")
10 5a1949a4 Julien Enselme
log_file="${d7_dir_log}/${current_day}.log"
11
12 481fd023 Julien Enselme
echo -e "#### ${command} - ${current_time}\n${log}\n#### END\n" >> "${log_file}"