# \[SOLVED\] Centos 7 compatible init.d or systemd script for Asterisk 13

**URL:** <https://community.asterisk.org/t/solved-centos-7-compatible-init-d-or-systemd-script-for-asterisk-13/66359>\
**Category:** Uncategorized\
**Created:** [April 13, 2016, 1:32am UTC](https://community.asterisk.org/t/solved-centos-7-compatible-init-d-or-systemd-script-for-asterisk-13/66359 "2016-04-13T01:32:11Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Furious-George](https://avatars.discourse-cdn.com/v4/letter/f/ba9def/32.png) [@Furious-George](https://community.asterisk.org/u/Furious-George)\
**Post date:** [April 15, 2016, 12:31am UTC](https://community.asterisk.org/t/solved-centos-7-compatible-init-d-or-systemd-script-for-asterisk-13/66359/2 "2016-04-15T00:31:42Z")

</div>

I solved this by:

`mv /etc/init.d/asterisk ~/asterisk.init.d.bak`

`vi /etc/systemd/system/asterisk.service`

… and I put in …

```
[Unit]
Description=Asterisk PBX and telephony daemon
Documentation=man:asterisk(8)
Wants=network.target
After=network.target

[Service]
Type=simple
User=asterisk
Group=asterisk
Environment=HOME=/var/lib/asterisk
WorkingDirectory=/var/lib/asterisk
ExecStart=/usr/sbin/asterisk -f -C /etc/asterisk/asterisk.conf
ExecStop=/usr/sbin/asterisk -rx 'core stop now'
ExecReload=/usr/bin/asterisk -rx 'core reload'

# safe_asterisk emulation
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target

```

… and then running …

`systemctl deamon-reload`  
`systemctl enable asterisk`  
`systemctl restart asterisk`

Hope this helps someone.

With minor modifications, the service comes from here:

[Source](https://issues.asterisk.org/jira/browse/ASTERISK-21991)

---

_[View the full topic](https://community.asterisk.org/t/solved-centos-7-compatible-init-d-or-systemd-script-for-asterisk-13/66359)._
