File tree 6 files changed +139
-0
lines changed
logrotate/etc/logrotate.d 6 files changed +139
-0
lines changed Original file line number Diff line number Diff line change
1
+ /var/log/ehfs/*.log {
2
+ weekly
3
+ missingok
4
+ rotate 10
5
+ compress
6
+ delaycompress
7
+ notifempty
8
+ create
9
+ sharedscripts
10
+ postrotate
11
+ kill -HUP $(pidof ehfs)
12
+ endscript
13
+ }
Original file line number Diff line number Diff line change
1
+ --root /data
2
+ --hide lost+found
3
+ --access-log /var/log/ehfs/access.log
4
+ --error-log /var/log/ehfs/error.log
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+ #
3
+ # ehfs - Go HTTP File Server
4
+ #
5
+ # chkconfig: 35 85 15
6
+ # description: Go HTTP File Server
7
+ # processname: ehfs
8
+ # config: /etc/ehfs.conf
9
+
10
+ # Source function library.
11
+ . /etc/rc.d/init.d/functions
12
+
13
+ # Source networking configuration.
14
+ . /etc/sysconfig/network
15
+
16
+ # Check that networking is up.
17
+ [ " $NETWORKING " = " no" ] && exit 0
18
+
19
+ ehfs=" /usr/local/bin/ehfs"
20
+ prog=$( basename $ehfs )
21
+
22
+ sysconfig=" /etc/sysconfig/$prog "
23
+ [ -f " $sysconfig " ] && . " $sysconfig "
24
+
25
+ pidfile=" /var/run/${prog} .pid"
26
+
27
+ start () {
28
+ echo -n $" Starting $prog : "
29
+ setcap CAP_NET_BIND_SERVICE=+ep " $ehfs "
30
+ mkdir -p /var/log/ehfs/
31
+ runuser nobody -- " $ehfs " --config=/etc/ehfs.conf &
32
+ retval=$?
33
+ echo
34
+ if [ $retval -eq 0 ]; then
35
+ echo -n " $! " > " $pidfile "
36
+ success
37
+ else
38
+ failure
39
+ fi
40
+ return $retval
41
+ }
42
+
43
+ stop () {
44
+ echo -n $" Stopping $prog : "
45
+ killproc -p " $pidfile " " $prog "
46
+ retval=$?
47
+ echo
48
+ return $retval
49
+ }
50
+
51
+ restart () {
52
+ stop
53
+ start
54
+ }
55
+
56
+ _status () {
57
+ status $prog
58
+ }
59
+
60
+ _status_q () {
61
+ _status > /dev/null 2>&1
62
+ }
63
+
64
+ case " $1 " in
65
+ start)
66
+ _status_q && exit 0
67
+ $1
68
+ ;;
69
+ stop)
70
+ _status_q || exit 0
71
+ $1
72
+ ;;
73
+ restart | reload)
74
+ restart
75
+ ;;
76
+ status)
77
+ _status
78
+ ;;
79
+ status_q)
80
+ _status_q
81
+ ;;
82
+ condrestart | try-restart)
83
+ _status_q || exit 7
84
+ restart
85
+ ;;
86
+ * )
87
+ echo $" Usage: $0 {start|stop|reload|status|restart}"
88
+ exit 2
89
+ ;;
90
+ esac
Original file line number Diff line number Diff line change
1
+ --root /data
2
+ --hide lost+found
3
+ --access-log /var/log/ehfs/access.log
4
+ --error-log /var/log/ehfs/error.log
Original file line number Diff line number Diff line change
1
+ [Unit]
2
+ Description =Extra http file server
3
+ After =network.target
4
+
5
+ [Service]
6
+ Type =simple
7
+ ExecStartPre =/sbin/setcap CAP_NET_BIND_SERVICE =+ep /usr/local/bin/ehfs
8
+ ExecStart =/sbin/runuser -u nobody -- /usr/local/bin/ehfs --config =/etc/ehfs.conf
9
+ ExecReload =/bin/kill -s HUP $MAINPID
10
+ KillSignal =SIGTERM
11
+ KillMode =process
12
+
13
+ [Install]
14
+ WantedBy =multi-user.target
Original file line number Diff line number Diff line change
1
+ [Unit]
2
+ Description =Extra http file server
3
+ After =network.target
4
+
5
+ [Service]
6
+ Type =simple
7
+ ExecStartPre =/sbin/setcap CAP_NET_BIND_SERVICE =+ep /usr/local/bin/ehfs
8
+ ExecStart =/sbin/runuser -u nobody -- /usr/local/bin/ehfs --config =/etc/ehfs_%I.conf
9
+ ExecReload =/bin/kill -s HUP $MAINPID
10
+ KillSignal =SIGTERM
11
+ KillMode =process
12
+
13
+ [Install]
14
+ WantedBy =multi-user.target
You can’t perform that action at this time.
0 commit comments