A real systemd unit for alert5
This commit is contained in:
parent
fedbc5b579
commit
ed17676432
9
evolinux-base/files/alert5.service
Normal file
9
evolinux-base/files/alert5.service
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Evolix alert5 script
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/usr/share/scripts/alert5.sh
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
|
@ -116,29 +116,56 @@
|
||||||
|
|
||||||
## alert5
|
## alert5
|
||||||
|
|
||||||
- name: Install alert5 init script
|
- name: Install alert5 init script (jessie)
|
||||||
template:
|
template:
|
||||||
src: system/init_alert5.j2
|
src: system/alert5.sysvinit.j2
|
||||||
dest: /etc/init.d/alert5
|
dest: /etc/init.d/alert5
|
||||||
force: no
|
force: no
|
||||||
mode: "0755"
|
mode: "0755"
|
||||||
when: evolinux_system_alert5_init
|
when:
|
||||||
|
- evolinux_system_alert5_init
|
||||||
|
- ansible_distribution_release == "jessie"
|
||||||
|
|
||||||
|
- name: Enable alert5 init script (jessie)
|
||||||
#TODO: switch service/systemd modules with Ansible 2.2+
|
|
||||||
|
|
||||||
- name: Enable alert5 init script
|
|
||||||
service:
|
service:
|
||||||
name: alert5
|
name: alert5
|
||||||
enabled: yes
|
enabled: yes
|
||||||
when: evolinux_system_alert5_init and evolinux_system_alert5_enable
|
when:
|
||||||
|
- evolinux_system_alert5_init
|
||||||
|
- evolinux_system_alert5_enable
|
||||||
|
- ansible_distribution_release == "jessie"
|
||||||
|
|
||||||
# - name: Enable alert5 init script
|
|
||||||
# systemd:
|
|
||||||
# name: alert5
|
- name: Install alert5 init script (stretch)
|
||||||
# daemon_reload: yes
|
template:
|
||||||
# enabled: yes
|
src: system/alert5.sh.j2
|
||||||
# when: evolinux_system_alert5_init and evolinux_system_alert5_enable
|
dest: /usr/share/scripts/alert5.sh
|
||||||
|
force: no
|
||||||
|
mode: "0755"
|
||||||
|
when:
|
||||||
|
- evolinux_system_alert5_init
|
||||||
|
- ansible_distribution_major_version | version_compare('9', '>=')
|
||||||
|
|
||||||
|
- name: Install alert5 service (stretch)
|
||||||
|
copy:
|
||||||
|
src: alert5.service
|
||||||
|
dest: /etc/systemd/system/alert5.service
|
||||||
|
force: yes
|
||||||
|
mode: "0755"
|
||||||
|
when:
|
||||||
|
- evolinux_system_alert5_init
|
||||||
|
- ansible_distribution_major_version | version_compare('9', '>=')
|
||||||
|
|
||||||
|
- name: Enable alert5 init script (stretch)
|
||||||
|
systemd:
|
||||||
|
name: alert5
|
||||||
|
daemon_reload: yes
|
||||||
|
enabled: yes
|
||||||
|
when:
|
||||||
|
- evolinux_system_alert5_init
|
||||||
|
- evolinux_system_alert5_enable
|
||||||
|
- ansible_distribution_major_version | version_compare('9', '>=')
|
||||||
|
|
||||||
## network interfaces
|
## network interfaces
|
||||||
|
|
||||||
|
|
7
evolinux-base/templates/system/alert5.sh.j2
Normal file
7
evolinux-base/templates/system/alert5.sh.j2
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
## sends a mail when booting
|
||||||
|
date | mail -s'boot/reboot' {{ reboot_alert_email or general_alert_email | mandatory }}
|
||||||
|
|
||||||
|
## starts the firewall
|
||||||
|
#/etc/init.d/minifirewall start
|
Loading…
Reference in a new issue