Difference between revisions of "AVR watch-dog daemon for Linkstation"
(→Install) |
Lsuser1985 (Talk | contribs) m (Remove category `Hacking`.) |
||
(20 intermediate revisions by 7 users not shown) | |||
Line 1: | Line 1: | ||
− | {{Template:Articles}} | + | {{Template:Articles|}} |
− | + | {|align="right" width="75%" | |
− | + | |- | |
+ | |{{Brick|The daemon discussed in this article is essential to the LinkStation's operation. If its ''keep-alive'' messages are not sent, the LS' watchdog timer will trigger a shutdown.}} | ||
+ | |} | ||
== Description == | == Description == | ||
− | '''avr_evtd''' is an operating system daemon and should be started from /etc/init.d or /usr/local/sbin. It will return immediately, so you don't need to start it with '&'. | + | '''avr_evtd''' is an operating system daemon and should be started from /etc/init.d or /usr/local/sbin. It will return immediately, so you don't need to start it with '&'. It can replace the propritary [[ppc_uartd]] ([[LS1]]) and [[Information/MIPSelAVR#mc_ctld|mc_ctld]] ([[LS2]]) daemons. |
− | avr_evtd is a simple and small user space interface to the Linkstation AVR micro-controller. It doesn't have a lot of special features, but it's main task is to provide 'keep-alive' messages to the Linkstation's on-board AVR device. This device controls/monitors the fan, various LEDs, timed power up and two buttons. This daemon provides the necessary initialisation to the device and also stimulates the LEDs depending on various fault conditions. It also monitors a power button (located at the front) and a reset button (located at the rear). | + | avr_evtd is a simple and small user space interface to the Linkstation [[AVR]] micro-controller (note: technically, the LS2 doesn't contain an AVR, but avr_evtd, works with the LS2, too). It doesn't have a lot of special features, but it's main task is to provide 'keep-alive' messages to the Linkstation's on-board AVR device. This device controls/monitors the fan, various LEDs, timed power up and two buttons. This daemon provides the necessary initialisation to the device and also stimulates the LEDs depending on various fault conditions. It also monitors a power button (located at the front) and a reset button (located at the rear). |
avr_evtd searches for a configuration file located within the /etc/melco at start-up time. If this file does not exist, then it reverts to reading the file located at /etc/default/avr_evtd. Additionally, it periodically checks the root /dev/hda1 partition and the user data partition /dev/hda3 to ensure they are mounted. Also, if requested, it will determine if sufficient space remains and if not then the AVR is requested to illuminate the DISK LED. This periodic checking also takes place on the configuration files. If they are deemed to have been updated, then the daemon will respond accordingly. | avr_evtd searches for a configuration file located within the /etc/melco at start-up time. If this file does not exist, then it reverts to reading the file located at /etc/default/avr_evtd. Additionally, it periodically checks the root /dev/hda1 partition and the user data partition /dev/hda3 to ensure they are mounted. Also, if requested, it will determine if sufficient space remains and if not then the AVR is requested to illuminate the DISK LED. This periodic checking also takes place on the configuration files. If they are deemed to have been updated, then the daemon will respond accordingly. | ||
Line 28: | Line 30: | ||
cd / | cd / | ||
wget <link to latest version from sourcecforge site> | wget <link to latest version from sourcecforge site> | ||
− | tar - | + | tar -zxvf <filename from wget download> |
*build the source and install process daemon and configuration files | *build the source and install process daemon and configuration files | ||
cd /usr/src/avr_evtd | cd /usr/src/avr_evtd | ||
make install avr_evtd | make install avr_evtd | ||
+ | *alternatively, if you do not have gcc installed | ||
+ | |||
+ | cd /usr/src/avr_evtd | ||
+ | make -n install avr_evtd | ||
*modify /etc/default/avr_evtd.sample to suit your needs (refer to below for more information) and save as avr_evtd. | *modify /etc/default/avr_evtd.sample to suit your needs (refer to below for more information) and save as avr_evtd. | ||
Line 38: | Line 44: | ||
'''FreeLink''' | '''FreeLink''' | ||
− | For those with ppc_uartd (LS1, HG, HS, KURO) | + | For those with ppc_uartd ([[LS1]], [[HG]], [[HS]], KURO) |
update-rc.d -f ppc_uartd remove | update-rc.d -f ppc_uartd remove | ||
− | or for the | + | or for the MIPSel [[LS2]] |
update-rc.d -f mc_ctld remove | update-rc.d -f mc_ctld remove | ||
Line 46: | Line 52: | ||
rm /etc/rc2.d/S95ppc_uartd | rm /etc/rc2.d/S95ppc_uartd | ||
rm /etc/rc0.d/K95ppc_uartd | rm /etc/rc0.d/K95ppc_uartd | ||
− | or | + | or (MIPSel) |
rm /etc/rc2.d/mc_ctld | rm /etc/rc2.d/mc_ctld | ||
rm /etc/rc0.d/mc_ctld | rm /etc/rc0.d/mc_ctld | ||
− | '''OpenLink''' | + | '''OpenLink PPC''' |
rm /etc/rc.d/rc2.d/S95ppc_uartd | rm /etc/rc.d/rc2.d/S95ppc_uartd | ||
rm /etc/rc.d/rc0.d/K95ppc_uartd | rm /etc/rc.d/rc0.d/K95ppc_uartd | ||
Line 94: | Line 100: | ||
<tt># Sample avr_evtd daemon configuration file</tt> | <tt># Sample avr_evtd daemon configuration file</tt> | ||
<tt># PLEASE EDIT THIS FILE TO SUIT</tt> | <tt># PLEASE EDIT THIS FILE TO SUIT</tt> | ||
+ | <tt>LOG=/var/log</tt> | ||
<tt>DEBUG=ON</tt> | <tt>DEBUG=ON</tt> | ||
<tt># Set to YES to enable the EM-Mode feature, default no</tt> | <tt># Set to YES to enable the EM-Mode feature, default no</tt> | ||
− | <tt>EMMODE=YES | + | <tt>EMMODE=YES</tt> |
<tt>#</tt> | <tt>#</tt> | ||
<tt># Timed shutdown flag (ON enables timed power down/up only</tt> | <tt># Timed shutdown flag (ON enables timed power down/up only</tt> | ||
Line 118: | Line 125: | ||
<tt># percentage used at which the disk LED will illuminate</tt> | <tt># percentage used at which the disk LED will illuminate</tt> | ||
<tt>DISKCHECK=90</tt> | <tt>DISKCHECK=90</tt> | ||
+ | <tt># Specifies the root partition to check, no default</tt> | ||
+ | <tt>ROOT=hda1</tt> | ||
+ | <tt># Specifies the working partition to check, no default</tt> | ||
+ | <tt>WORK=hda3</tt> | ||
<tt># Disk/AVR refresh rate (seconds), default 40</tt> | <tt># Disk/AVR refresh rate (seconds), default 40</tt> | ||
<tt>REFRESH=40</tt> | <tt>REFRESH=40</tt> | ||
Line 128: | Line 139: | ||
Meaning: | Meaning: | ||
− | <<tt>DEBUG=ON</tt> | + | <tt>LOG=/var/log</tt> |
+ | Specifies the location of the debug log files. Note, this size of this file is not restricited | ||
+ | so if enabled, some logrotate mechanism maybe desirable. | ||
+ | <tt>DEBUG=ON</tt> | ||
Debug data will be generated. This can be disabled by setting this entry to '''NO'''. | Debug data will be generated. This can be disabled by setting this entry to '''NO'''. | ||
− | + | <tt>EMMODE=YES</tt> | |
Enables the selection of EM-Mode from the reset button (hold for > 20 seconds). To disable, set this | Enables the selection of EM-Mode from the reset button (hold for > 20 seconds). To disable, set this | ||
− | entry to '''NO'''. | + | entry to '''NO'''. If this is changed whilst the daemon is up, then it will be ignored. This is only |
+ | observed at startup (to protect against accidental enable) and the daemon will need to be restarted (either | ||
+ | by reboot or from '''/etc/init.d/avr_evtd restart''') if the user requires instant on. When enabled, a ps aux | ||
+ | will show a '''-e''' in the avr_evtd command line. | ||
<tt>TIMER=YES</tt> | <tt>TIMER=YES</tt> | ||
Timed shutdown/power on is enabled. To disable, set this to '''NO'''. This will turn-off the sleep mode | Timed shutdown/power on is enabled. To disable, set this to '''NO'''. This will turn-off the sleep mode | ||
Line 162: | Line 179: | ||
to 0 (zero) or another value from 1-100%. When the disk usage exceeds this value, then an event is triggered through | to 0 (zero) or another value from 1-100%. When the disk usage exceeds this value, then an event is triggered through | ||
the EventScript which can be used to additional clean-up if required. | the EventScript which can be used to additional clean-up if required. | ||
+ | <tt>ROOT=hda1</tt> | ||
+ | This allows the user to specify what the root partition is for the DISKCHECK process. There | ||
+ | is no default partition for this so setting to 'blank' means no checking of the root | ||
+ | partition is performed. Also note, no syntax or validation is performed on this entry. | ||
+ | <tt>WORK=hda3</tt> | ||
+ | This allows the user to specify what the working partition is for the DISKCHECK process. There | ||
+ | is no default partition for this so setting to 'blank' means no checking of the work | ||
+ | partition is performed. Also note, no syntax or validation is performed on this entry. | ||
<tt>REFRESH=40</tt> | <tt>REFRESH=40</tt> | ||
The avr refresh rate is set to 40 seconds. This is the rate at which the daemon pings the micro-controller and checks | The avr refresh rate is set to 40 seconds. This is the rate at which the daemon pings the micro-controller and checks | ||
Line 172: | Line 197: | ||
then set this to '''ON'''. | then set this to '''ON'''. | ||
<tt>FANSTOP=30</tt> | <tt>FANSTOP=30</tt> | ||
− | A fan event will be generated if stationary for more than 30 seconds. This can be changed from 1 to 60 seconds. For HG | + | A fan event will be generated if stationary for more than 30 seconds. This can be changed from 1 to 60 seconds or to OFF. For HG |
uses a lower time maybe more desirable as these units run hotter. | uses a lower time maybe more desirable as these units run hotter. | ||
+ | |||
+ | When set to OFF, ensure that there is enough ventilation to allow the heat build-up to | ||
+ | escape. This simply sets the daemon to ignore fan failure messages. | ||
+ | |||
+ | |||
+ | == Files == | ||
+ | |||
+ | The following files are used by the avr_evtd daemon: | ||
+ | * /etc/default/avr_evtd | ||
+ | * /etc/avr_evtd/EventScript | ||
+ | * /etc/avr_evtd/emergency_eth0 | ||
+ | * $LOG/avr_evtd.log (default is /var/log/avr_evtd/log) | ||
+ | |||
+ | The '''/etc/default/avr_evtd''' is the configuration file, as descibed in the setup. | ||
+ | |||
+ | The next file, '''EventScript''', is what is invoked by the daemon on an event. This being a | ||
+ | button and/or action event request. This is described below and is scripted in this | ||
+ | fashion to allow users to perform any other desired action following the event. | ||
+ | |||
+ | The next file, '''emergency_eth0''', is used to configure the ethernet device if the reset | ||
+ | button is double pressed. This establishes an EM IP of 192.168.11.150 and also requests | ||
+ | a DHCP server. | ||
+ | |||
+ | The log file, whose directory is specified by the '''LOG''' entry in the configuration file | ||
+ | and is enabled by setting '''DEBUG=ON''' records all the events. | ||
== Event Handling == | == Event Handling == | ||
Line 248: | Line 298: | ||
<tt>exit 0</tt> | <tt>exit 0</tt> | ||
+ | == Troubleshooting == | ||
+ | ''' EventScript doesn't run? ''' | ||
+ | |||
+ | If EventScript fails to run, then it could be because /bin/sh isn't symlinked to /bin/bash. The script uses ${param:start:offset} notation for a 'substring' operation which /bin/sh doesn't understand (on [[User:mflint|mflint]]'s Ubuntu Kurobox, anyway). | ||
+ | |||
+ | To fix this, either make a symlink from /bin/sh to /bin/bash, or (preferred) change #!/bin/sh to #!/bin/bash at the top of EventScript. | ||
+ | [[Category:LS1]] | ||
+ | [[Category:LS2]] | ||
+ | [[Category:HG]] | ||
+ | [[Category:Software]] | ||
[[Category:Hardware]] | [[Category:Hardware]] | ||
− |
Latest revision as of 15:42, 18 January 2013
|
Description
avr_evtd is an operating system daemon and should be started from /etc/init.d or /usr/local/sbin. It will return immediately, so you don't need to start it with '&'. It can replace the propritary ppc_uartd (LS1) and mc_ctld (LS2) daemons.
avr_evtd is a simple and small user space interface to the Linkstation AVR micro-controller (note: technically, the LS2 doesn't contain an AVR, but avr_evtd, works with the LS2, too). It doesn't have a lot of special features, but it's main task is to provide 'keep-alive' messages to the Linkstation's on-board AVR device. This device controls/monitors the fan, various LEDs, timed power up and two buttons. This daemon provides the necessary initialisation to the device and also stimulates the LEDs depending on various fault conditions. It also monitors a power button (located at the front) and a reset button (located at the rear).
avr_evtd searches for a configuration file located within the /etc/melco at start-up time. If this file does not exist, then it reverts to reading the file located at /etc/default/avr_evtd. Additionally, it periodically checks the root /dev/hda1 partition and the user data partition /dev/hda3 to ensure they are mounted. Also, if requested, it will determine if sufficient space remains and if not then the AVR is requested to illuminate the DISK LED. This periodic checking also takes place on the configuration files. If they are deemed to have been updated, then the daemon will respond accordingly.
Any failures are normally routed through the log files. With timed shutdown/power up, a warning will be broadcast to all users (console message) when within 5 or less minutes of power off. Also, fan failure alerts will be broadcast in this fashion. Failure to determine mounted partition /dev/hda3 will result in the DIAG LED flashing three times, repeatedly.
A new feature of this daemon is the ability to code events for single or groups of days. This allows the user to add any number of power-on/off events as required. This also has the added benifit of being able to shut down the device for longer periods. The internal AVR timer has a 12-bit resolution timer which can power up the linkstation from a maximum of a sixty eight hour sleep: from time of invocation. The AVR is updated again at time of power down/shutdown to re-validate the timer, in case of time updates (either by user or ntp). This will also preserve the 68 hour sleep resolution.
Install
Get the latest version from https://sourceforge.net/projects/ppc-evtd
cd / wget <link to latest version from sourcecforge site> tar -zxvf <filename from wget download>
- build the source and install process daemon and configuration files
cd /usr/src/avr_evtd make install avr_evtd
- alternatively, if you do not have gcc installed
cd /usr/src/avr_evtd make -n install avr_evtd
- modify /etc/default/avr_evtd.sample to suit your needs (refer to below for more information) and save as avr_evtd.
- remove current daemon ppc_uartd (or mc_ctld for MIPS) if applicable
FreeLink
For those with ppc_uartd (LS1, HG, HS, KURO)
update-rc.d -f ppc_uartd remove
or for the MIPSel LS2
update-rc.d -f mc_ctld remove
To manually remove
rm /etc/rc2.d/S95ppc_uartd rm /etc/rc0.d/K95ppc_uartd
or (MIPSel)
rm /etc/rc2.d/mc_ctld rm /etc/rc0.d/mc_ctld
OpenLink PPC
rm /etc/rc.d/rc2.d/S95ppc_uartd rm /etc/rc.d/rc0.d/K95ppc_uartd
- add the new daemon links
FreeLink
update-rc.d avr_evtd start 12 2 . stop 95 0 6 .
Manually
cd /etc/rc2.d ln -s ../init.d/avr_evtd S12avr_evtd cd /etc/init.d/rc0.d ln -s ../init.d/avr_evtd K95avr_evtd cd /etc/rc6.d ln -s ../init.d/avr_evtd K95avr_evtd
OpenLink
cd /etc/rc.d/rc2.d ln -s ../init.d/avr_evtd S12avr_evtd cd /etc/init.d/rc0.d ln -s ../init.d/avr_evtd K95avr_evtd cd /etc/rc.d/rc6.d ln -s ../init.d/avr_evtd K95avr_evtd
- check the daemon is running
ps aux | grep avr_evtd
- observe /usr/local/sbin/avr_evtd in the output line
Setup
/etc/default/avr_evtd configuration file is the fallback file in the event that the stock melco files do not exist. The file is read at initial start-up in order to determine if timed shutdown is required and if the disk usage is to be monitored. The file should be always located within the /etc/default directory and a sample file is provided. The file format is similar to other Unix configuration files - comments begin with a # character and extend to the end of the line; blank lines are ignored. Configuration commands consist of an initial keyword followed by an argument. Arguments may be strings or times written in HH:MM (UTC) format. Optional arguments are delimited by [ ] in the following descriptions, while alternatives are separated by |.
This is an example configuration file:
# Sample avr_evtd daemon configuration file # PLEASE EDIT THIS FILE TO SUIT LOG=/var/log DEBUG=ON # Set to YES to enable the EM-Mode feature, default no EMMODE=YES # # Timed shutdown flag (ON enables timed power down/up only # or use days of the week MONWEDSAT etc # if SHUTDOWN and POWERON are also specified) TIMER=ON # To override the device scan, specify the desired # serial port connection to the AVR below and remove the # comment #DEVICE=/dev/ttyS1 # MACRO day/group switching ON/OFF times in 24hr HH:MM MON=ON=08:00,OFF=21:00,ON=23:30 TUE=OFF=02:30,ON=09:00,OFF=21:45 WED-FRI=ON=08:00,OFF=22:00 SAT=ON=07:30,OFF=08:30 # Shutdown (default) time specified in 24hr format HH:MM SHUTDOWN= # Power on (default) time specified in 24hr format HH:MM POWERON= # Disk check, set to OFF or a value (0-100) specifying a # percentage used at which the disk LED will illuminate DISKCHECK=90 # Specifies the root partition to check, no default ROOT=hda1 # Specifies the working partition to check, no default WORK=hda3 # Disk/AVR refresh rate (seconds), default 40 REFRESH=40 # Hold time (seconds) for button power-off, default 3 HOLD=3 # Enable/disable continous disk full messages, default off DISKNAG=OFF # Fan stationary fault timer (seconds), default 30 FANSTOP=30
Meaning:
LOG=/var/log
Specifies the location of the debug log files. Note, this size of this file is not restricited so if enabled, some logrotate mechanism maybe desirable.
DEBUG=ON
Debug data will be generated. This can be disabled by setting this entry to NO.
EMMODE=YES
Enables the selection of EM-Mode from the reset button (hold for > 20 seconds). To disable, set this entry to NO. If this is changed whilst the daemon is up, then it will be ignored. This is only observed at startup (to protect against accidental enable) and the daemon will need to be restarted (either by reboot or from /etc/init.d/avr_evtd restart) if the user requires instant on. When enabled, a ps aux will show a -e in the avr_evtd command line.
TIMER=YES
Timed shutdown/power on is enabled. To disable, set this to NO. This will turn-off the sleep mode option of the box.
The following are macro'd power switching events. These can be removed if this is not required. Shown here as an example only.
TUE=OFF=02:30,ON=09:00,OFF=21:45 WED-FRI=ON=08:00,OFF=22:00 SAT=ON=07:30,OFF=08:30
- For monday, the box will power on at 08:00, off at 21:00 and on again at 23:30
- Tuesday, the box will power off at 02:30, on at 09:00 and off at 21:45
- Wednesday throught friday, the box will power on at 08:00 and off at 22:00
- Saturday, the box will power on at 07:30 and off at 08:30
- Sunday, the box will not power up
SHUTDOWN= POWERON=
No default shutdown or power on time is defined. If macro'd timing is not required and then power switching can be specified through these options only. Alternatively, if power-on of 07:30 and off at 23:30 is all that is required then it can be specified through the macro event handler via:
- SUN-MON=ON=07:30,OFF=23:30
NOTE:The macro list of days must be in the correct order for the scheduler to work correctly:
- This order is SUN, MON, TUE, WED, THR, FRI and SAT.
DISKCHECK=90
The disk led will illuminate if either /dev/hda1 or /dev/hda3 is above 90% used. This can be disabled by setting to 0 (zero) or another value from 1-100%. When the disk usage exceeds this value, then an event is triggered through the EventScript which can be used to additional clean-up if required.
ROOT=hda1
This allows the user to specify what the root partition is for the DISKCHECK process. There is no default partition for this so setting to 'blank' means no checking of the root partition is performed. Also note, no syntax or validation is performed on this entry.
WORK=hda3
This allows the user to specify what the working partition is for the DISKCHECK process. There is no default partition for this so setting to 'blank' means no checking of the work partition is performed. Also note, no syntax or validation is performed on this entry.
REFRESH=40
The avr refresh rate is set to 40 seconds. This is the rate at which the daemon pings the micro-controller and checks on disk usage. This can be pushed out to 300 seconds if less frequent pinging is required.
HOLD=3
The button hold time for power off is set to 3 seconds. Can be changed from 3 to 10 seconds. This is the time the power button has to be depressed for before the daemon issues the shutdown event.
DISKNAG=OFF
Continous disk event messages on disk full is disabled. If repeated messages are required all the time the disk is full, then set this to ON.
FANSTOP=30
A fan event will be generated if stationary for more than 30 seconds. This can be changed from 1 to 60 seconds or to OFF. For HG uses a lower time maybe more desirable as these units run hotter.
When set to OFF, ensure that there is enough ventilation to allow the heat build-up to escape. This simply sets the daemon to ignore fan failure messages.
Files
The following files are used by the avr_evtd daemon:
- /etc/default/avr_evtd
- /etc/avr_evtd/EventScript
- /etc/avr_evtd/emergency_eth0
- $LOG/avr_evtd.log (default is /var/log/avr_evtd/log)
The /etc/default/avr_evtd is the configuration file, as descibed in the setup.
The next file, EventScript, is what is invoked by the daemon on an event. This being a button and/or action event request. This is described below and is scripted in this fashion to allow users to perform any other desired action following the event.
The next file, emergency_eth0, is used to configure the ethernet device if the reset button is double pressed. This establishes an EM IP of 192.168.11.150 and also requests a DHCP server.
The log file, whose directory is specified by the LOG entry in the configuration file and is enabled by setting DEBUG=ON records all the events.
Event Handling
Any event, such as button or fault, is handled by the daemon and some are made available externally through /etc/avr_evtd/EventScript. A default example of this is shown below:
DEVICE=$2 # # Populate the configured settings # [ -f /etc/default/avr_evtd ] && . /etc/default/avr_evtd /dev/null 2>&1 if [ "$DEBUG" = "ON" ]; then echo "`date` command is $1 for $DEVICE" >> /etc/avr_evtd/events.log fi case "$1" in 0) if [ -e /sbin/utelnetd ]; then /sbin/utelnetd -p1234 -l /bin/bash & fi ;; 1) echo -n "[avr_evtd]: AVR failure dectected!" # Perform halt /sbin/shutdown -h now ;; 2) echo -n "[avr_evtd]: Shutdown request" # Perform shutdown request /sbin/shutdown -h now ;; 3) echo -n "[avr_evtd]: Power Button Up" ;; 4) echo -n "[avr_evtd]: Power Button Down" ;; 5) echo -n "[avr_evtd]: Reset Button Up" ;; 6) echo -n "[avr_evtd]: Reset Button Down" ;; 7) echo -n "[avr_evtd]: Timed shutdown" echo -n "EEEE" > $DEVICE # Perform shutdown request /sbin/shutdown -h now ;; 8) echo -n "[avr_evtd]: AVR demanded reset" echo -n "CCCC" > $DEVICE # Perform reboot /sbin/reboot ;; 9) echo -n "[avr_evtd]: Disk used > $DISKCHECK%" ;; E) echo -n "[avr_evtd]: EM mode selected" # Determine flash block to use if [ -f /proc/mtd ]; then MTD=`cat /proc/mtd | grep mtd_status` BLOCK_ID=${MTD:3:1} FLASH=/dev/mtdblock$BLOCK_ID else FLASH=/dev/fl3 fi # Flash device available? if [ -n "$FLASH" ]; then DUMP=`cat $FLASH` STATE=${DUMP:2:4} # Check state is currently NORMAL if [ "$STATE" = "OKOK" ]; then echo -n "NGNGNG" > $FLASH fi fi echo -n "CCCC" > $DEVICE /sbin/reboot ;; F) echo -n "[avr_evtd]: Fan failure detected" # Illuminate relevant LED and wait for AVR halt message echo -n "iiii" > $DEVICE ;; *) exit 1 ;; esac exit 0
Troubleshooting
EventScript doesn't run?
If EventScript fails to run, then it could be because /bin/sh isn't symlinked to /bin/bash. The script uses ${param:start:offset} notation for a 'substring' operation which /bin/sh doesn't understand (on mflint's Ubuntu Kurobox, anyway).
To fix this, either make a symlink from /bin/sh to /bin/bash, or (preferred) change #!/bin/sh to #!/bin/bash at the top of EventScript.