=== modified file 'sbin/zsvgen' --- sbin/zsvgen 2014-02-13 01:01:55 +0000 +++ sbin/zsvgen 2014-02-09 22:11:43 +0000 @@ -6,29 +6,8 @@ zsv_parse for name in $svtab; do - zsv_eval $name zsv_dir=$zsv_svdir/$name mkdir -p $zsv_dir - - # flags - zsv_flags=${svtab_flags[$name]} - if [[ $zsv_flags == *'!'* ]]; then - touch $zsv_dir/down - else - if $checkf; then - rm -f $zsv_dir/down - if [[ -S $zsv_control ]]; then - echo -n u > $zsv_control - fi - else - touch $zsv_dir/down - if [[ -S $zsv_control ]]; then - echo -n d > $zsv_control - fi - fi - fi - - # run [[ -L $zsv_dir/run ]] && rm $zsv_dir/run ln -s ${commands[zsv.run]} $zsv_dir/run @@ -43,6 +22,15 @@ echo x >$zsv_dir/log/supervise/control rm -rf $zsv_dir/log fi + + # flags + zsv_flags=${svtab_flags[$name]} + if [[ $zsv_flags == *'!'* ]]; then + touch $zsv_dir/down + else + rm -f $zsv_dir/down + fi + done mkdir -p /run/service @@ -50,10 +38,3 @@ [[ -L /run/service/$name ]] && rm /run/service/$name ln -s ../zsv/$name /run/service done - -remove=( /run/zsv/*~*/(${~${(j:|:)svtab}})(N/) ) -if (($#remove)); then - sv_exit=( $^remove/supervise/control(N) ) - (($#sv_exit)) && sv exit $sv_exit - rm -rf $remove -fi === modified file 'zsh-functions/zsv_config' --- zsh-functions/zsv_config 2014-02-13 01:01:55 +0000 +++ zsh-functions/zsv_config 2014-02-09 22:33:48 +0000 @@ -7,6 +7,7 @@ : ${zsv_svtab:=/etc/svtab} : ${zsv_default_runf=zsv_generic} : ${zsv_default_logf=zsv_logger} +: ${zsv_cgroup=/sys/fs/cgroup/zsv/$zsv_name} # autoload all zsv_ functions local -a func_files @@ -21,5 +22,4 @@ autoload -Uz ${f:t} done -[[ -n $zsv_dir ]] && zsv_setdirs # vim: ft=zsh noet ts=4 sts=4 sw=4 === removed file 'zsh-functions/zsv_eval' --- zsh-functions/zsv_eval 2014-02-13 01:01:55 +0000 +++ zsh-functions/zsv_eval 1970-01-01 00:00:00 +0000 @@ -1,14 +0,0 @@ -typeset -g runf logf checkf -if (( $# )); then - zsv_setdirs $1 -fi -runf=${zsv_default_runf} -logf=${zsv_default_logf} -checkf=check -check() { - true -} - -[[ -n $svtab_sh[$zsv_name] ]] && eval $svtab_sh[zsv_name] - -# vim: ft=zsh noet ts=4 sts=4 sw=4 === modified file 'zsh-functions/zsv_log_run' --- zsh-functions/zsv_log_run 2014-02-13 01:01:55 +0000 +++ zsh-functions/zsv_log_run 2014-02-10 07:40:11 +0000 @@ -1,9 +1,8 @@ zsv_mode=log zsv_dir=$1:a:h:h autoload -Uz zsv_config; zsv_config -zsv_parse -zsv_eval +autoload -Uz zsv_parse; zsv_parse [[ -n $zsv_sh ]] && eval $zsv_sh -(($+functions[$logf])) || autoload -Uz $logf -$logf +(($+functions[$zsv_logf])) || autoload -Uz $zsv_logf +$zsv_logf # vim: ft=zsh noet ts=4 sts=4 sw=4 === modified file 'zsh-functions/zsv_parse' --- zsh-functions/zsv_parse 2014-02-13 01:01:55 +0000 +++ zsh-functions/zsv_parse 2014-02-09 21:53:08 +0000 @@ -1,19 +1,19 @@ typeset -g -a svtab typeset -g -A svtab_flags svtab_runf svtab_logf svtab_sh -typeset -g zsv_flags zsv_sh -local name flags sh -while IFS=: read name flags sh; do +typeset -g zsv_flags zsv_runf zsv_logf zsv_sh +local name flags runf logf sh +while IFS=: read name flags runf logf sh; do [[ $name == '#'* ]] && continue svtab+=$name svtab_flags[$name]=${flags:-$zsv_default_flags} - # svtab_runf[$name]=${runf:-$zsv_default_runf} - # svtab_logf[$name]=${logf:-$zsv_default_logf} + svtab_runf[$name]=${runf:-$zsv_default_runf} + svtab_logf[$name]=${logf:-$zsv_default_logf} svtab_sh[$name]=${sh:-$zsv_default_sh} - # if [[ $name == $zsv_name ]]; then - # zsv_flags=${flags:-$zsv_default_flags} - # zsv_runf=${runf:-$zsv_default_runf} - # zsv_logf=${logf:-$zsv_default_logf} - # zsv_sh=${sh:-$zsv_default_sh} - # fi + if [[ $name == $zsv_name ]]; then + zsv_flags=${flags:-$zsv_default_flags} + zsv_runf=${runf:-$zsv_default_runf} + zsv_logf=${logf:-$zsv_default_logf} + zsv_sh=${sh:-$zsv_default_sh} + fi done <$zsv_svtab # vim: ft=zsh noet ts=4 sts=4 sw=4 === modified file 'zsh-functions/zsv_run' --- zsh-functions/zsv_run 2014-02-13 01:01:55 +0000 +++ zsh-functions/zsv_run 2014-02-10 07:40:11 +0000 @@ -1,8 +1,8 @@ zsv_mode=run zsv_dir=$1:a:h autoload -Uz zsv_config; zsv_config -zsv_parse -zsv_eval -(($+functions[$runf])) || autoload -Uz $runf -$runf +autoload -Uz zsv_parse; zsv_parse +[[ -n $zsv_sh ]] && eval $zsv_sh +(($+functions[$zsv_runf])) || autoload -Uz $zsv_runf +$zsv_runf # vim: ft=zsh noet ts=4 sts=4 sw=4 === removed file 'zsh-functions/zsv_setdirs' --- zsh-functions/zsv_setdirs 2014-02-13 01:01:55 +0000 +++ zsh-functions/zsv_setdirs 1970-01-01 00:00:00 +0000 @@ -1,9 +0,0 @@ -if [[ -n $1 ]]; then - zsv_dir=$1 -fi -zsv_name=$zsv_dir:t -zsv_svdir=$zsv_dir:h -zsv_cgroup=/sys/fs/cgroup/zsv/$zsv_name -zsv_control=$zsv_dir/supervise/control -zsv_log_control=$zsv_dir/log/supervise/control -# vim: ft=zsh noet ts=4 sts=4 sw=4