summaryrefslogtreecommitdiff
path: root/office/taskd/rc.taskd.diff
blob: 9cd4d59e41e115da9a1ee9ba07ce786707f5cde7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
--- 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="$@"