Script in misccommands
Posted: Fri May 16, 2014 2:57 am
Hi everybody,
i would like to call a script from misccommands.cfg.
This script send notifications infos to a txt file,
which is named according to YearMonthDayHourMinutesSecondsNanoseconds,
and then this same file is copied in the same folder but with OK at the end of file.
For services the code is
The problem
When i execute it, everything works fine
When i put in in the misccommand.cfg file to execute it, it doesn't work.
Thanks for your help.
i would like to call a script from misccommands.cfg.
This script send notifications infos to a txt file,
which is named according to YearMonthDayHourMinutesSecondsNanoseconds,
and then this same file is copied in the same folder but with OK at the end of file.
For services the code is
Code: Select all
#!/bin/sh
Date=$(date +%Y%m%d%H%M%S%N)
nomFic=notif$Date
cat <<eof > /tmp/notifications/$nomFic
"SERVICE ALERT:
Type Notification: $NOTIFICATIONTYPE$
Service: $SERVICEDISPLAYNAME$
Sur hote: $HOSTALIAS$
Groupe Service: $SERVICEGROUPALIAS$
Etat: $SERVICESTATE$
ID Service: $SERVICESTATEID$
Descriptif: $LONGSERVICEOUTPUT$
Date Heure: $SHORTDATETIME$"
eof
cp -u -p /tmp/notifications/$nomFic /tmp/notifications/${nomFic}_OKWhen i execute it, everything works fine
When i put in in the misccommand.cfg file to execute it, it doesn't work.
Thanks for your help.