Startup

41 views
Skip to first unread message

Jason Horsman

unread,
Oct 19, 2020, 1:52:42 PM10/19/20
to CrafterCMS
How do I go about making it so the crafter authoring software automatically starts when the system boots up? I'm on a CentOS host. I've tried adding scripts to rc.local but crafter keeps giving me messages about not wanting to run as root. I don't want to always have to login to start the software. Thanks.

Sumer Jabri

unread,
Oct 19, 2020, 3:26:38 PM10/19/20
to CrafterCMS
The reason for not running as root are security-related (never a good idea). Two ways you can run automatically (I'm sure others can think of more):
1) In your rc.local, run it as the user `crafter` by using the command `sudo -i -u crafter /opt/crafter/bin/startup.sh`
2) Install this script in /usr/lib/systemd/system/crafter.service`
```
[Unit]
Description=Crafter CMS

[Service]
User=crafter
Group=crafter
ExecStart=/bin/bash /opt/crafter/bin/startup.sh
ExecStop=/bin/bash /opt/crafter/bin/shutdown.sh
RemainAfterExit=true

[Install]
WantedBy=multi-user.target
```
and then execute:
```
        sudo chcon -t systemd_unit_file_t /usr/lib/systemd/system/crafter.service
        sudo systemctl daemon-reload
        sudo systemctl enable crafter.service
```

That will effectively create a service called `crafter` and make it enabled by default. You can now start it and stop it etc.

Needless to say, #2 is generally better for prod installs.

Hope that helps.

--sumer
Reply all
Reply to author
Forward
0 new messages