comparison packaging/linux-installer.inc.in @ 764:5b505acbb2d1

Handle system wide installation for crontab.
author Sascha Wilde <wilde@intevation.de>
date Fri, 04 Jul 2014 18:41:23 +0200
parents 654a8ca9d5b4
children 7c3a8a8d3e52
comparison
equal deleted inserted replaced
763:654a8ca9d5b4 764:5b505acbb2d1
197 done 197 done
198 } 198 }
199 199
200 setup_cronjob() 200 setup_cronjob()
201 { 201 {
202 # FIXME: handle case of system wide installation.
203 local tmpcrontab=`mktemp` 202 local tmpcrontab=`mktemp`
204 crontab -l | grep -vF "${instcfg[PREFIX]}/bin/trustbridge-tray-starter.sh" \ 203 local crontabopt=''
205 >"$tmpcrontab" 204 if [ $SYSINST -eq 1 -a "${SUDO_USER+X}" ] ; then
205 crontabopt="-u $SUDO_USER"
206 fi
207 crontab $crontabopt -l | \
208 grep -vF "${instcfg[PREFIX]}/bin/trustbridge-tray-starter.sh" \
209 >"$tmpcrontab"
206 if [ "$1" != "deinstall" ] ; then 210 if [ "$1" != "deinstall" ] ; then
207 echo "$(( $RANDOM / 555 )) 12 * * * \"${instcfg[PREFIX]}/bin/trustbridge-tray-starter.sh\"" \ 211 echo "$(( $RANDOM / 555 )) 12 * * * \"${instcfg[PREFIX]}/bin/trustbridge-tray-starter.sh\"" \
208 >>"$tmpcrontab" 212 >>"$tmpcrontab"
209 fi 213 fi
210 crontab "$tmpcrontab" 214 crontab $crontabopt "$tmpcrontab"
211 rm "$tmpcrontab" 215 rm "$tmpcrontab"
212 } 216 }
213 217
214 remove_cronjob() 218 remove_cronjob()
215 { 219 {

http://wald.intevation.org/projects/trustbridge/