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…')
 
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:rchan]]
+
[[Category:rchan]][[Category:OPS535]]
 
= Systemd wiki page - reference =
 
= Systemd wiki page - reference =
 
* [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

Latest revision as of 09:42, 7 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