Open main menu

CDOT Wiki β

Changes

Startup script with systemd

793 bytes added, 08:29, 5 October 2015
Created page with 'Category:rchan = Systemd wiki page - reference = * [https://fedoraproject.org/wiki/Systemd Systemd] = ops535 = Example: To run a script on system boot in a systemd environmen…'
[[Category:rchan]]
= Systemd wiki page - reference =
* [https://fedoraproject.org/wiki/Systemd Systemd]
= ops535 =
Example: To run a script on system boot in a systemd environment
Name of the script file: ops535
File path: /usr/bin/ops535
<pre>
[ops535@localhost ~]$ cat /usr/bin/ops535
#! /bin/bash
/usr/sbin/route add -net 192.168.55.0 netmask 255.255.255.0 gw 192.168.122.1
# you can put you ifconfig/ip addr command
# route add command
# and other commands here
# make sure the file permission is 655
</pre>

= ops535.service =
File Path: /etc/systemd/system/ops535.service
<pre>
[Unit]
Description=OPS535 Network routes setup
After=systemd-user-sessions.service

[Service]
Type=oneshot
ExecStart=/usr/bin/ops535

[Install]
WantedBy=multi-user.target
</pre>
1,760
edits