service_args is now an array

This commit is contained in:
Jack L. Frost 2015-09-04 16:47:37 +03:00
parent 623cf0795e
commit 6ef5b97beb
47 changed files with 66 additions and 157 deletions

View File

@ -2,4 +2,4 @@
#service_respawn='true' #service_respawn='true'
service_command='/usr/bin/acpid' service_command='/usr/bin/acpid'
service_args="-f" service_args=( -f )

View File

@ -2,4 +2,4 @@
service_respawn='true' service_respawn='true'
service_command='/usr/bin/agetty' service_command='/usr/bin/agetty'
service_args="38400 ${service_name##*-} linux" service_args=( 38400 "${service_name##*-}" linux )

View File

@ -2,7 +2,7 @@
#service_respawn='true' #service_respawn='true'
service_command='/usr/bin/alsactl' service_command='/usr/bin/alsactl'
service_args="rdaemon" service_args=( rdaemon )
stop() { stop() {
"$service_command" kill save_and_quit "$service_command" kill save_and_quit

View File

@ -3,7 +3,7 @@
#service_respawn='true' #service_respawn='true'
service_username='torrent' service_username='torrent'
service_command='/usr/bin/sudo' service_command='/usr/bin/sudo'
service_args="-u $service_username -- /usr/bin/bitflu --config=/etc/bitflu.cfg" service_args=( -u "$service_username" -- /usr/bin/bitflu --config=/etc/bitflu.cfg )
start() { start() {
umask 0007 umask 0007

View File

@ -4,4 +4,4 @@
#service_respawn=true #service_respawn=true
service_command='/usr/bin/bitlbee' service_command='/usr/bin/bitlbee'
service_args='-n' service_args=( -n )

View File

@ -2,4 +2,4 @@
#service_respawn='true' #service_respawn='true'
service_command='/usr/bin/chronyd' service_command='/usr/bin/chronyd'
service_args='-u chrony' service_args=( -u chrony )

View File

@ -5,4 +5,4 @@ depends dbus || return 1
#service_respawn='true' #service_respawn='true'
service_command='/usr/bin/connmand' service_command='/usr/bin/connmand'
service_args='-n' service_args=( -n )

View File

@ -2,4 +2,4 @@
#service_respawn='true' #service_respawn='true'
service_command='/usr/bin/cupsd' service_command='/usr/bin/cupsd'
service_args="-f" service_args=( -f )

View File

@ -2,7 +2,7 @@
#service_respawn=true #service_respawn=true
service_command='/usr/bin/dbus-daemon' service_command='/usr/bin/dbus-daemon'
service_args='--system --nofork' service_args=( --system --nofork )
service_tmpfiles=( '/run/dbus:dir' ) service_tmpfiles=( '/run/dbus:dir' )
start_pre() { start_pre() {

View File

@ -1,31 +0,0 @@
#!/usr/bin/env watchman
service_type='oneshot'
cfg_mounts+=( 'dev:devtmpfs:defaults:/dev' )
cfg_mounts+=( '/dev/pts:devpts:noexec,nosuid,gid=5,mode=0620:/dev/pts' )
cfg_mounts+=( '/dev/mqueue:mqueue:noexec,nosuid,nodev:/dev/mqueue' )
cfg_mounts+=( 'tmpfs:tmpfs:defaults,mode=0777:/dev/shm' )
spawn() {
for m in ${cfg_mounts[@]}; do
fs_dev=`echo "$m" | cut -d':' -f1`
fs_type=`echo "$m" | cut -d':' -f2`
fs_opts=`echo "$m" | cut -d':' -f3`
fs_mountpoint=`echo "$m" | cut -d':' -f4`
mountpoint -q "$fs_mountpoint" || {
[[ -d "$fs_mountpoint" ]] || { mkdir "$fs_mountpoint"; }
mount "$fs_dev" -n -t "$fs_type" -o "$fs_opts" "$fs_mountpoint"
}
done
}
stop() {
for m in "${cfg_mounts[@]}"; do
fs_mountpoint=`echo "$m" | cut -d ':' -f 4`
mountpoint -q "$fs_mountpoint" && {
umount "$fs_mountpoint"
}
done
}

View File

@ -3,4 +3,4 @@
#service_respawn=true #service_respawn=true
service_command='/usr/bin/dhcpcd' service_command='/usr/bin/dhcpcd'
service_args='-B' service_args=( -B )

View File

@ -4,7 +4,7 @@ docker_dir='/home/docker'
#service_respawn='true' #service_respawn='true'
service_command='/usr/bin/docker' service_command='/usr/bin/docker'
service_args="-g ${docker_dir} -d" service_args=( -g "$docker_dir" -d )
update() { update() {
watchman.stop && { watchman.stop && {

View File

@ -2,4 +2,4 @@
service_respawn=true service_respawn=true
service_command='/usr/bin/dropbear' service_command='/usr/bin/dropbear'
service_args="-R -w -F" service_args=( -R -w -F )

View File

@ -15,11 +15,7 @@ udev.populate_dev() {
udevadm control --property=do_not_run_plug_service= udevadm control --property=do_not_run_plug_service=
} }
start() { post_start() { sleep 1; udev.populate_dev; }
watchman.start
sleep 1
udev.populate_dev
}
reload() { reload() {
udevadm control --reload udevadm control --reload

View File

@ -9,4 +9,4 @@ fi
service_type='oneshot' service_type='oneshot'
service_command='/usr/bin/hostname' service_command='/usr/bin/hostname'
service_args="$cfg_hostname" service_args=( "$cfg_hostname" )

View File

@ -3,4 +3,4 @@
#service_respawn=true #service_respawn=true
service_command='/usr/sbin/dhcpd' service_command='/usr/sbin/dhcpd'
service_args='-f' service_args=( -f )

View File

@ -4,4 +4,4 @@ tty=${service_name##*-};
service_respawn='true' service_respawn='true'
service_command='/usr/bin/kmscon' service_command='/usr/bin/kmscon'
service_args="--vt ${tty}" service_args=( --vt "$tty" )

View File

@ -4,7 +4,7 @@ cfg_iface="${service_name%%.*}"
service_type='oneshot' service_type='oneshot'
service_command='/usr/bin/ip' service_command='/usr/bin/ip'
service_args="link set $cfg_iface up" service_args=( link set "$cfg_iface" up)
wait_for_iface() { wait_for_iface() {
local iface="$1" timer='0' timeout='6' local iface="$1" timer='0' timeout='6'

View File

@ -3,4 +3,4 @@
#service_respawn='true' #service_respawn='true'
service_workdir='/usr' service_workdir='/usr'
service_command='/usr/bin/mysqld_safe' service_command='/usr/bin/mysqld_safe'
service_args='--datadir=/var/lib/mysql' service_args=( --datadir=/var/lib/mysql )

View File

@ -2,14 +2,9 @@
service_type='oneshot' service_type='oneshot'
service_command='/usr/bin/mdev' service_command='/usr/bin/mdev'
service_args='-s' service_args=( -s )
hotplug() { post_start() {
echo "Enabling hotplug..." echo "Enabling hotplug..."
echo /bin/mdev > /proc/sys/kernel/hotplug echo /bin/mdev > /proc/sys/kernel/hotplug
} }
start() {
watchman.start
hotplug
}

View File

@ -2,4 +2,4 @@
#service_respawn=true #service_respawn=true
service_command='/usr/bin/memcached' service_command='/usr/bin/memcached'
service_args='-m 64 -p 11211 -u nobody -l 127.0.0.1' service_args=( -m 64 -p 11211 -u nobody -l 127.0.0.1 )

View File

@ -1,34 +0,0 @@
#!/usr/bin/env watchman
service_type='oneshot'
cfg_mounts+=( 'proc:proc:defaults:/proc' )
cfg_mounts+=( 'run:tmpfs:defaults:/run' )
cfg_mounts+=( 'sys:sysfs:defaults:/sys' )
spawn() {
for m in ${cfg_mounts[@]}; do
fs_dev=`echo "$m" | cut -d':' -f1`
fs_type=`echo "$m" | cut -d':' -f2`
fs_opts=`echo "$m" | cut -d':' -f3`
fs_mountpoint=`echo "$m" | cut -d':' -f4`
mountpoint -q "$fs_mountpoint" || {
[[ -d "$fs_mountpoint" ]] || { mkdir "$fs_mountpoint"; }
mount "$fs_dev" -n -t "$fs_type" -o "$fs_opts" "$fs_mountpoint" || {
watchman.err "could not mount $fs_dev on $fs_mountpoint :("
}
}
done
return 0
}
stop() {
for m in "${cfg_mounts[@]}"; do
fs_mountpoint=`echo "$m" | cut -d ':' -f 4`
mountpoint -q "$fs_mountpoint" && {
umount "$fs_mountpoint"
}
done
}

View File

@ -2,4 +2,4 @@
#service_respawn=true #service_respawn=true
service_command='/usr/bin/mpd' service_command='/usr/bin/mpd'
service_args='--no-daemon' service_args=( --no-daemon )

View File

@ -5,4 +5,4 @@ cfg_nrpe_config='/etc/nrpe/nrpe.cfg'
#service_respawn=true #service_respawn=true
service_command='/usr/bin/nrpe' service_command='/usr/bin/nrpe'
service_pidfile='/run/nrpe.pid' service_pidfile='/run/nrpe.pid'
service_args="-c ${cfg_nrpe_config} -d" service_args=( -c "$cfg_nrpe_config" -d )

View File

@ -2,4 +2,4 @@
#service_respawn='true' #service_respawn='true'
service_command='/usr/bin/ntpd' service_command='/usr/bin/ntpd'
service_args='-n' service_args=( -n )

View File

@ -1,4 +1,4 @@
#!/usr/bin/watchman #!/usr/bin/watchman
service_command='/usr/bin/oidentd' service_command='/usr/bin/oidentd'
service_args='-i' service_args=( -i )

View File

@ -2,4 +2,4 @@
#service_respawn='true' #service_respawn='true'
service_command='/usr/bin/ntpd' service_command='/usr/bin/ntpd'
service_args='-d' service_args=( -d )

View File

@ -5,4 +5,4 @@ cfg_ovpn_instance="${service_name##*-}"
service_respawn='true' service_respawn='true'
service_command="/usr/bin/openvpn" service_command="/usr/bin/openvpn"
service_workdir="/etc/openvpn/$cfg_ovpn_instance" service_workdir="/etc/openvpn/$cfg_ovpn_instance"
service_args="client.cfg" service_args=( client.cfg )

View File

@ -3,4 +3,4 @@
service_respawn='true' service_respawn='true'
service_command="/usr/sbin/openvpn" service_command="/usr/sbin/openvpn"
service_workdir="/etc/openvpn" service_workdir="/etc/openvpn"
service_args="server.conf" service_args=( server.conf )

View File

@ -1,5 +1,5 @@
#!/usr/bin/env watchman #!/usr/bin/env watchman
service_command='/usr/bin/mkdir'
service_args='-p /run/lock'
service_type='oneshot' service_type='oneshot'
service_command='/usr/bin/mkdir'
service_args=( -p /run/lock )

View File

@ -2,4 +2,4 @@
#service_respawn='true' #service_respawn='true'
service_command='/usr/bin/php-fpm' service_command='/usr/bin/php-fpm'
service_args='-F --fpm-config /etc/php/php-fpm.conf -c /etc/php/php.ini' service_args=( -F --fpm-config /etc/php/php-fpm.conf -c /etc/php/php.ini )

View File

@ -2,4 +2,4 @@
#service_respawn='true' #service_respawn='true'
service_command='/usr/bin/preload' service_command='/usr/bin/preload'
service_args='-f' service_args=( -f )

View File

@ -5,10 +5,10 @@ privoxy_configfile='/etc/privoxy/config'
#service_respawn='true' #service_respawn='true'
service_command='/usr/bin/privoxy' service_command='/usr/bin/privoxy'
service_args="--no-daemon --user ${privoxy_username} ${privoxy_configfile}" service_args=( --no-daemon --user "$privoxy_username" "$privoxy_configfile" )
privoxy::configtest() { privoxy::configtest() {
"${service_command}" --config-test ${service_args} "$service_command" --config-test "${service_args[@]}"
} }
restart() { restart() {

View File

@ -3,4 +3,4 @@
#service_respawn=true #service_respawn=true
service_command='/usr/bin/rsyslogd' service_command='/usr/bin/rsyslogd'
service_args='-n' service_args=( -n )

View File

@ -2,4 +2,4 @@
#service_respawn='true' #service_respawn='true'
service_command='/usr/bin/crond' service_command='/usr/bin/crond'
service_args='-n' service_args=( -n )

View File

@ -2,14 +2,9 @@
service_type='oneshot' service_type='oneshot'
service_command='/usr/bin/smdev' service_command='/usr/bin/smdev'
service_args='-s' service_args=( -s )
hotplug() { post_start() {
echo "Enabling hotplug..." echo "Enabling hotplug..."
echo /bin/smdev > /proc/sys/kernel/hotplug echo /bin/smdev > /proc/sys/kernel/hotplug
} }
start() {
watchman.start
hotplug
}

View File

@ -4,13 +4,8 @@ cfg_sshd_cfgdir='/etc/ssh'
service_respawn=true service_respawn=true
service_command='/usr/bin/sshd' service_command='/usr/bin/sshd'
service_args="-D -f $cfg_sshd_cfgdir/sshd_config" service_args=( -D -f "$cfg_sshd_cfgdir/sshd_config" )
sshd_genkeys() { pre_start() {
[[ -e "/etc/ssh/ssh_host_key" ]] || { ssh-keygen -A; } [[ -e "/etc/ssh/ssh_host_key" ]] || { ssh-keygen -A; }
} }
start() {
sshd_genkeys
watchman.start
}

View File

@ -1,13 +1,23 @@
#!/usr/bin/env watchman #!/usr/bin/env watchman
unset reload
for i in /etc/sysctl.conf /etc/sysctl.d/* /usr/lib/sysctl.d/*; do
[[ -f "$i" ]] && {
sysctl_config_files+=( "$i" )
}
done
service_type='oneshot' service_type='oneshot'
service_command='/usr/bin/sysctl' service_command='/usr/bin/sysctl'
service_args="-p ${sysctl_config_files[@]}"
unset restart reload pre_start() {
for i in /etc/sysctl.conf /etc/sysctl.d/* /usr/lib/sysctl.d/*; do
[[ -f "$i" ]] && {
sysctl_config_files+=( "$i" )
}
done
service_args=( -p "${sysctl_config_files[@]}" )
}
start() {
if ! [[ "$sysctl_config_files" ]]; then
return 0
fi
watchman.start
}

View File

@ -2,4 +2,4 @@
#service_respawn=true #service_respawn=true
service_command='/usr/bin/syslog-ng' service_command='/usr/bin/syslog-ng'
service_args='-F' service_args=( -F )

View File

@ -1,13 +0,0 @@
#!/usr/bin/env watchman
unset start stop restart reload status
reboot() {
echo "Rebooting..."
kill -2 1
}
poweroff() {
echo "Powering off..."
kill -10 1
}

View File

@ -15,11 +15,7 @@ udev.populate_dev() {
udevadm control --property=do_not_run_plug_service= udevadm control --property=do_not_run_plug_service=
} }
start() { post_start() { sleep 1; udev.populate_dev; }
watchman.start
sleep 1
udev.populate_dev
}
reload() { reload() {
udevadm control --reload udevadm control --reload

View File

@ -3,4 +3,4 @@
#service_respawn=true #service_respawn=true
service_pidfile='/run/teamviewerd.pid' service_pidfile='/run/teamviewerd.pid'
service_command='/opt/teamviewer8/tv_bin/teamviewerd' service_command='/opt/teamviewer8/tv_bin/teamviewerd'
service_args='-d' service_args=( -d )

View File

@ -2,4 +2,4 @@
#service_respawn='true' #service_respawn='true'
service_command='/usr/bin/unbound' service_command='/usr/bin/unbound'
service_args='-d' service_args=( -d )

View File

@ -2,5 +2,5 @@
#service_respawn='true' #service_respawn='true'
service_command='/usr/bin/vdevd' service_command='/usr/bin/vdevd'
service_args='-f /dev' service_args=( -f /dev )
service_tmpfiles=( '/run/vdev:dir' '/run/udev:symlink:/dev/metadata/udev' ) service_tmpfiles=( '/run/vdev:dir' '/run/udev:symlink:/dev/metadata/udev' )

View File

@ -2,4 +2,4 @@
#service_respawn='true' #service_respawn='true'
service_command='/usr/bin/crond' service_command='/usr/bin/crond'
service_args='-f' service_args=( -f )

View File

@ -2,4 +2,4 @@
#service_respawn=true #service_respawn=true
service_command='/usr/bin/xinetd' service_command='/usr/bin/xinetd'
service_args='-dontfork' service_args=( -dontfork )

View File

@ -2,7 +2,7 @@
service_type='oneshot' service_type='oneshot'
service_command='/usr/local/sbin/znet' service_command='/usr/local/sbin/znet'
service_args='-d' service_args=( -d )
stop() { stop() {
"$service_command" $service_args down "$service_command" $service_args down