summaryrefslogtreecommitdiffstats
path: root/office/taskd/rc.taskd.diff
blob: 9cd4d59e41e115da9a1ee9ba07ce786707f5cde7 (plain)
--- src/taskdctl	2014-09-04 15:15:11.000000000 -0600
+++ rc.taskd	2014-09-05 00:58:33.000000000 -0600
@@ -26,13 +26,49 @@
 ##
 ################################################################################
 
+################################################################################
+# SLACKWARE STARTUP:
+#
+# Before this script may be run the following conditions must be met:
+#
+#       A taskd user must exist
+#       The data path must exist and be owned by the taskd user
+#       The data path must be set in $TASKDDATA or in /etc/taskddata
+#       The server must have been previously initialized by
+#               taskd init --data $TASKDDATA
+#
+#       Additional configuration parameters must be valid and CA installed
+#
+#       See /usr/doc/taskd-VERSION/README_SLACKWARE and man taskd for details.
+#
+# To auto start taskd at boot add these lines to /etc/rc.d/rc.local
+# if [ -x /etc/rc.d/rc.taskd ]; then
+#       /etc/rc.d/rc.taskd start
+# fi
+#
+# To stop taskd at shutdown add these lines to /etc/rc.d/rc.local_shutdown
+# if [ -x /etc/rc.d/rc.taskd ]; then
+#        /etc/rc.d/rc.taskd stop
+# fi
+################################################################################
+
+#Initialize from global config for convenience - SlackBuild patch
+if [ -z $TASKDDATA ] && [ -f /etc/taskddata ] ; then
+	. /etc/taskddata
+fi
+
 if [ -z $TASKDDATA ] ; then
-  echo 'The TASKDDATA variable must be set.'
-  exit
+	echo 'The TASKDDATA variable must be set.'
+	exit
 fi
 
 PIDFILE=$(taskd config --data $TASKDDATA | grep pid.file | awk '{print $2}')
-DAEMON="taskd server --data $TASKDDATA --daemon"
+DAEMON="taskd_ctl $TASKDDATA"
+
+taskd_ctl(){
+	EX="taskd server --data $1 --daemon"
+	su - taskd -c "$EX"
+}
 
 ERROR=0
 ARGV="$@"