Parcourir la source

init.d -> systemctl

Alex Payne il y a 9 ans
Parent
révision
372f84473f

+ 0
- 139
roles/ircbouncer/files/etc_init.d_znc Voir le fichier

@@ -1,139 +0,0 @@
1
-#! /bin/sh
2
-### BEGIN INIT INFO
3
-# Provides:          znc
4
-# Required-Start:    $remote_fs $syslog
5
-# Required-Stop:     $remote_fs $syslog
6
-# Default-Start:     2 3 4 5
7
-# Default-Stop:      0 1 6
8
-# Short-Description: ZNC IRC bouncer
9
-# Description:       ZNC is an IRC bouncer
10
-### END INIT INFO
11
- 
12
-PATH=/sbin:/usr/sbin:/bin:/usr/bin
13
-DESC="ZNC daemon"
14
-NAME=znc
15
-DAEMON=/usr/local/bin/$NAME
16
-DATADIR=/var/lib/znc
17
-DAEMON_ARGS="--datadir=$DATADIR"
18
-PIDDIR=/var/run/znc
19
-PIDFILE=$PIDDIR/$NAME.pid
20
-SCRIPTNAME=/etc/init.d/$NAME
21
-USER=znc
22
-GROUP=znc
23
-
24
-# Exit if the package is not installed
25
-[ -x "$DAEMON" ] || exit 0
26
-
27
-# Read configuration variable file if it is present
28
-[ -r /etc/default/$NAME ] && . /etc/default/$NAME
29
-
30
-# Load the VERBOSE setting and other rcS variables
31
-. /lib/init/vars.sh
32
-
33
-# Define LSB log_* functions.
34
-# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
35
-# and status_of_proc is working.
36
-. /lib/lsb/init-functions
37
-
38
-#
39
-# Function that starts the daemon/service
40
-#
41
-do_start()
42
-{
43
-  # Return
44
-  #   0 if daemon has been started
45
-  #   1 if daemon was already running
46
-  #   2 if daemon could not be started
47
-  if [ ! -d $PIDDIR ]
48
-  then
49
-    mkdir $PIDDIR
50
-  fi
51
-  chown $USER:$GROUP $PIDDIR
52
-  start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test --chuid $USER > /dev/null || return 1
53
-  start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --chuid $USER -- $DAEMON_ARGS > /dev/null || return 2
54
-}
55
-
56
-#
57
-# Function that stops the daemon/service
58
-#
59
-do_stop()
60
-{
61
-  # Return
62
-  #   0 if daemon has been stopped
63
-  #   1 if daemon was already stopped
64
-  #   2 if daemon could not be stopped
65
-  #   other if a failure occurred
66
-  start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME --chuid $USER
67
-  RETVAL="$?"
68
-  [ "$RETVAL" = 2 ] && return 2
69
-  # Wait for children to finish too if this is a daemon that forks
70
-  # and if the daemon is only ever run from this initscript.
71
-  # If the above conditions are not satisfied then add some other code
72
-  # that waits for the process to drop all resources that could be
73
-  # needed by services started subsequently.  A last resort is to
74
-  # sleep for some time.
75
-  start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON --chuid $USER
76
-  [ "$?" = 2 ] && return 2
77
-  # Many daemons don't delete their pidfiles when they exit.
78
-  rm -f $PIDFILE
79
-  return "$RETVAL"
80
-}
81
-
82
-#
83
-# Function that sends a SIGHUP to the daemon/service
84
-#
85
-do_reload() {
86
-  start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME --chuid $USER
87
-  return 0
88
-}
89
-
90
-case "$1" in
91
-  start)
92
-  [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
93
-  do_start
94
-  case "$?" in
95
-    0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
96
-    2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
97
-  esac
98
-  ;;
99
-  stop)
100
-  [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
101
-  do_stop
102
-  case "$?" in
103
-    0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
104
-    2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
105
-  esac
106
-  ;;
107
-  status)
108
-  status_of_proc -p $PIDFILE "$DAEMON" "$NAME" && exit 0 || exit $?
109
-  ;;
110
-  reload)
111
-  log_daemon_msg "Reloading $DESC" "$NAME"
112
-  do_reload
113
-  log_end_msg $?
114
-  ;;
115
-  restart)
116
-  log_daemon_msg "Restarting $DESC" "$NAME"
117
-  do_stop
118
-  case "$?" in
119
-    0|1)
120
-    do_start
121
-    case "$?" in
122
-      0) log_end_msg 0 ;;
123
-      1) log_end_msg 1 ;; # Old process is still running
124
-      *) log_end_msg 1 ;; # Failed to start
125
-    esac
126
-    ;;
127
-    *)
128
-    # Failed to stop
129
-    log_end_msg 1
130
-    ;;
131
-  esac
132
-  ;;
133
-  *)
134
-  echo "Usage: $SCRIPTNAME {status|start|stop|reload|restart}" >&2
135
-  exit 3
136
-  ;;
137
-esac
138
-
139
-:

+ 3
- 3
roles/monitoring/files/etc_monit_conf.d_apache2 Voir le fichier

@@ -1,8 +1,8 @@
1 1
 check process apache2 with pidfile /var/run/apache2.pid
2 2
   group www
3
-  start program = "/etc/init.d/apache2 start"
4
-  stop program = "/etc/init.d/apache2 stop"
3
+  start program = "systemctl start apache2"
4
+  stop program = "systemctl stop apache2"
5 5
   if failed host localhost port 80 protocol http
6 6
     with timeout 10 seconds
7 7
     then restart
8
-  if 5 restarts within 5 cycles then timeout
8
+  if 5 restarts within 5 cycles then timeout

+ 2
- 2
roles/monitoring/files/etc_monit_conf.d_dovecot Voir le fichier

@@ -1,7 +1,7 @@
1 1
 check process dovecot with pidfile /var/run/dovecot/master.pid
2 2
   group mail
3
-  start program = "/etc/init.d/dovecot start"
4
-  stop program = "/etc/init.d/dovecot stop"
3
+  start program = "systemctl start dovecot"
4
+  stop program = "systemctl stop dovecot"
5 5
   if failed port 993 type tcpssl sslauto protocol imap for 5 cycles then restart
6 6
   if failed port 995 type tcpssl sslauto protocol pop for 5 cycles then restart
7 7
   if 3 restarts within 5 cycles then timeout

+ 2
- 2
roles/monitoring/files/etc_monit_conf.d_pgsql Voir le fichier

@@ -1,6 +1,6 @@
1 1
 check process postgres with pidfile /var/run/postgresql/9.1-main.pid
2 2
   group database
3
-  start program = "/etc/init.d/postgresql start"
4
-  stop program = "/etc/init.d/postgresql stop"
3
+  start program = "systemctl start postgresql"
4
+  stop program = "systemctl stop postgresql"
5 5
   if failed host localhost port 5432 protocol pgsql then restart
6 6
   if 5 restarts within 5 cycles then timeout

+ 3
- 3
roles/monitoring/files/etc_monit_conf.d_postfix Voir le fichier

@@ -1,6 +1,6 @@
1 1
 check process postfix with pidfile /var/spool/postfix/pid/master.pid
2 2
   group mail
3
-  start program = "/etc/init.d/postfix start"
4
-  stop  program = "/etc/init.d/postfix stop"
3
+  start program = "systemctl start postfix"
4
+  stop  program = "systemctl stop postfix"
5 5
   if failed port 25 protocol smtp then restart
6
-  if 5 restarts within 5 cycles then timeout
6
+  if 5 restarts within 5 cycles then timeout

+ 3
- 3
roles/monitoring/files/etc_monit_conf.d_sshd Voir le fichier

@@ -1,5 +1,5 @@
1 1
 check process sshd with pidfile /var/run/sshd.pid
2
-  start program "/etc/init.d/ssh start"
3
-  stop program "/etc/init.d/ssh stop"
2
+  start program "systemctl start sst"
3
+  stop program  "systemctl stop ssh"
4 4
   if failed host 127.0.0.1 port 22 protocol ssh then restart
5
-  if 5 restarts within 5 cycles then timeout
5
+  if 5 restarts within 5 cycles then timeout

+ 2
- 2
roles/monitoring/files/etc_monit_conf.d_znc Voir le fichier

@@ -1,7 +1,7 @@
1 1
 check process znc with pidfile /var/run/znc/znc.pid
2 2
   group irc
3
-  start program = "/etc/init.d/znc start"
4
-  stop program = "/etc/init.d/znc stop"
3
+  start program = "systemctl start znc"
4
+  stop program = "systemctl stop znc"
5 5
   if failed host localhost port 6643 protocol http
6 6
     with timeout 10 seconds
7 7
     then restart

+ 1
- 1
roles/vpn/templates/etc_rc.local Voir le fichier

@@ -15,6 +15,6 @@ iptables -A FORWARD -s 10.8.0.0/24 -j ACCEPT
15 15
 iptables -A FORWARD -j REJECT
16 16
 iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o {{ ansible_default_ipv4.interface }} -j MASQUERADE
17 17
 
18
-/etc/init.d/dnsmasq restart
18
+systemctl restart dnsmasq
19 19
 
20 20
 exit 0

+ 1
- 1
roles/xmpp/handlers/main.yml Voir le fichier

@@ -1,2 +1,2 @@
1 1
 - name: restart prosody
2
-  command: /etc/init.d/prosody restart
2
+  command: systemctl restart prosody

Chargement…
Annuler
Enregistrer