Difference between revisions of "Startup script with systemd"

From CDOT Wiki
Jump to: navigation, search
(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…')
 
(ops535)
Line 3: Line 3:
 
* [https://fedoraproject.org/wiki/Systemd Systemd]
 
* [https://fedoraproject.org/wiki/Systemd Systemd]
 
= ops535 =
 
= ops535 =
Example: To run a script on system boot in a systemd environment
+
Example: To run a script on system boot in a systemd environment:
Name of the script file: ops535
+
* Name of the script file: ops535
File path: /usr/bin/ops535
+
* File path: /usr/bin/ops535
 
<pre>
 
<pre>
 
[ops535@localhost ~]$ cat /usr/bin/ops535
 
[ops535@localhost ~]$ cat /usr/bin/ops535

Revision as of 08:30, 5 October 2015

Systemd wiki page - reference

ops535

Example: To run a script on system boot in a systemd environment:

  • Name of the script file: ops535
  • File path: /usr/bin/ops535
[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

ops535.service

File Path: /etc/systemd/system/ops535.service

[Unit]
Description=OPS535 Network routes setup
After=systemd-user-sessions.service

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

[Install]
WantedBy=multi-user.target