Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save MVKozlov/4e35a2fef1d867c1e79b9b2af4db6f4c to your computer and use it in GitHub Desktop.

Select an option

Save MVKozlov/4e35a2fef1d867c1e79b9b2af4db6f4c to your computer and use it in GitHub Desktop.

Revisions

  1. @houtianze houtianze revised this gist Oct 17, 2016. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions sysv.init.script.to.systemd.unit.file.md
    Original file line number Diff line number Diff line change
    @@ -12,4 +12,5 @@ Let's say you have a `SysV Init Script` named `foo`
    ```

    6. Enable the service: `systemd enable foo.service`
    7. (Optional) You can then remove the SysV script by running `chkconfig foo off && chkconfig --del foo`

  2. @houtianze houtianze revised this gist Oct 17, 2016. 1 changed file with 7 additions and 4 deletions.
    11 changes: 7 additions & 4 deletions sysv.init.script.to.systemd.unit.file.md
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,15 @@
    Let's say the `SysV Init Script` is called foo (the file `/etc/init.d/foo`):
    Let's say you have a `SysV Init Script` named `foo`

    1. systemd-sysv-generator will generate this file `/run/systemd/generator.late/foo.service`, copy this file to `/etc/systemd/system` by running: `cp /run/systemd/generator.late/foo.service /etc/systemd/system/foo.service`
    2. Edit `/etc/systemd/system/foo.service` by running `systemctl edit foo.service`, add in the following line to `foo.servie` (this makes the service installable)
    1. Copy the file to `/etc/init.d/foo`
    2. Enable the SysV service: `chkconfig --add foo`
    3. Enable the SysV service: `chkconfig foo on`
    4. Start the service: `service foo start`. After this, systemd-sysv-generator will generate this file `/run/systemd/generator.late/foo.service`, copy this file to `/etc/systemd/system` by running: `cp /run/systemd/generator.late/foo.service /etc/systemd/system/foo.service`
    5. Edit `/etc/systemd/system/foo.service` by running `systemctl edit foo.service`, add in the following line to `foo.servie` (this makes the service installable)

    ```
    [Install]
    WantedBy=multi-user.target
    ```

    3. Enable the service: `systemd enable foo.service`
    6. Enable the service: `systemd enable foo.service`

  3. @houtianze houtianze revised this gist Sep 22, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion sysv.init.script.to.systemd.unit.file.md
    Original file line number Diff line number Diff line change
    @@ -8,5 +8,5 @@ Let's say the `SysV Init Script` is called foo (the file `/etc/init.d/foo`):
    WantedBy=multi-user.target
    ```

    3. Enable the server: `systemd enable foo.service`
    3. Enable the service: `systemd enable foo.service`

  4. @houtianze houtianze revised this gist Sep 22, 2016. 1 changed file with 3 additions and 4 deletions.
    7 changes: 3 additions & 4 deletions sysv.init.script.to.systemd.unit.file.md
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,12 @@
    Let's say the `SysV Init Script` is called foo (the file `/etc/init.d/foo`):

    1. Start the service through Systemd: `systemctl start foo`
    2. systemd-sysv-generator will generate this file `/run/systemd/generator.late/foo.service`, copy this file to `/etc/systemd/system` by running: `cp /run/systemd/generator.late/foo.service /etc/systemd/system/foo.service`
    3. Edit `/etc/systemd/system/foo.service` by running `systemctl edit foo.service`, add in the following line to `foo.servie` (this makes the service installable)
    1. systemd-sysv-generator will generate this file `/run/systemd/generator.late/foo.service`, copy this file to `/etc/systemd/system` by running: `cp /run/systemd/generator.late/foo.service /etc/systemd/system/foo.service`
    2. Edit `/etc/systemd/system/foo.service` by running `systemctl edit foo.service`, add in the following line to `foo.servie` (this makes the service installable)

    ```
    [Install]
    WantedBy=multi-user.target
    ```

    4. Enable the server: `systemd enable foo.service`
    3. Enable the server: `systemd enable foo.service`

  5. @houtianze houtianze revised this gist Sep 22, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions sysv.init.script.to.systemd.unit.file.md
    Original file line number Diff line number Diff line change
    @@ -3,9 +3,11 @@ Let's say the `SysV Init Script` is called foo (the file `/etc/init.d/foo`):
    1. Start the service through Systemd: `systemctl start foo`
    2. systemd-sysv-generator will generate this file `/run/systemd/generator.late/foo.service`, copy this file to `/etc/systemd/system` by running: `cp /run/systemd/generator.late/foo.service /etc/systemd/system/foo.service`
    3. Edit `/etc/systemd/system/foo.service` by running `systemctl edit foo.service`, add in the following line to `foo.servie` (this makes the service installable)

    ```
    [Install]
    WantedBy=multi-user.target
    ```

    4. Enable the server: `systemd enable foo.service`

  6. @houtianze houtianze revised this gist Sep 22, 2016. 1 changed file with 5 additions and 4 deletions.
    9 changes: 5 additions & 4 deletions sysv.init.script.to.systemd.unit.file.md
    Original file line number Diff line number Diff line change
    @@ -2,9 +2,10 @@ Let's say the `SysV Init Script` is called foo (the file `/etc/init.d/foo`):

    1. Start the service through Systemd: `systemctl start foo`
    2. systemd-sysv-generator will generate this file `/run/systemd/generator.late/foo.service`, copy this file to `/etc/systemd/system` by running: `cp /run/systemd/generator.late/foo.service /etc/systemd/system/foo.service`
    3. Edit `/etc/systemd/system/foo.service` by running `systemctl edit foo.service`, add in the following line to `foo.servie` (this makes the service installable)`
    [Install]
    WantedBy=multi-user.target
    `
    3. Edit `/etc/systemd/system/foo.service` by running `systemctl edit foo.service`, add in the following line to `foo.servie` (this makes the service installable)
    ```
    [Install]
    WantedBy=multi-user.target
    ```
    4. Enable the server: `systemd enable foo.service`

  7. @houtianze houtianze revised this gist Sep 21, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions sysv.init.script.to.systemd.unit.file.md
    Original file line number Diff line number Diff line change
    @@ -2,9 +2,9 @@ Let's say the `SysV Init Script` is called foo (the file `/etc/init.d/foo`):

    1. Start the service through Systemd: `systemctl start foo`
    2. systemd-sysv-generator will generate this file `/run/systemd/generator.late/foo.service`, copy this file to `/etc/systemd/system` by running: `cp /run/systemd/generator.late/foo.service /etc/systemd/system/foo.service`
    3. Edit `/etc/systemd/system/foo.service` by running `systemctl edit foo.service`, add in the following line to `foo.servie` (this makes the service installable)```
    3. Edit `/etc/systemd/system/foo.service` by running `systemctl edit foo.service`, add in the following line to `foo.servie` (this makes the service installable)`
    [Install]
    WantedBy=multi-user.target
    ```
    `
    4. Enable the server: `systemd enable foo.service`

  8. @houtianze houtianze revised this gist Sep 21, 2016. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion sysv.init.script.to.systemd.unit.file.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,8 @@ Let's say the `SysV Init Script` is called foo (the file `/etc/init.d/foo`):

    1. Start the service through Systemd: `systemctl start foo`
    2. systemd-sysv-generator will generate this file `/run/systemd/generator.late/foo.service`, copy this file to `/etc/systemd/system` by running: `cp /run/systemd/generator.late/foo.service /etc/systemd/system/foo.service`
    3. Edit `/etc/systemd/system/foo.service` by running `systemctl edit foo.service`, add in the following line to `foo.servie` (this makes the service installable)```[Install]
    3. Edit `/etc/systemd/system/foo.service` by running `systemctl edit foo.service`, add in the following line to `foo.servie` (this makes the service installable)```
    [Install]
    WantedBy=multi-user.target
    ```
    4. Enable the server: `systemd enable foo.service`
  9. @houtianze houtianze revised this gist Sep 21, 2016. 1 changed file with 3 additions and 5 deletions.
    8 changes: 3 additions & 5 deletions sysv.init.script.to.systemd.unit.file.md
    Original file line number Diff line number Diff line change
    @@ -2,10 +2,8 @@ Let's say the `SysV Init Script` is called foo (the file `/etc/init.d/foo`):

    1. Start the service through Systemd: `systemctl start foo`
    2. systemd-sysv-generator will generate this file `/run/systemd/generator.late/foo.service`, copy this file to `/etc/systemd/system` by running: `cp /run/systemd/generator.late/foo.service /etc/systemd/system/foo.service`
    3. Edit `/etc/systemd/system/foo.service` by running `systemctl edit foo.service`, add in the following line to `foo.servie` (this makes the service installable)
    ```
    [Install]
    WantedBy=multi-user.target
    ```
    3. Edit `/etc/systemd/system/foo.service` by running `systemctl edit foo.service`, add in the following line to `foo.servie` (this makes the service installable)```[Install]
    WantedBy=multi-user.target
    ```
    4. Enable the server: `systemd enable foo.service`
  10. @houtianze houtianze revised this gist Sep 21, 2016. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions sysv.init.script.to.systemd.unit.file.md
    Original file line number Diff line number Diff line change
    @@ -3,9 +3,9 @@ Let's say the `SysV Init Script` is called foo (the file `/etc/init.d/foo`):
    1. Start the service through Systemd: `systemctl start foo`
    2. systemd-sysv-generator will generate this file `/run/systemd/generator.late/foo.service`, copy this file to `/etc/systemd/system` by running: `cp /run/systemd/generator.late/foo.service /etc/systemd/system/foo.service`
    3. Edit `/etc/systemd/system/foo.service` by running `systemctl edit foo.service`, add in the following line to `foo.servie` (this makes the service installable)
    ```
    [Install]
    WantedBy=multi-user.target
    ```
    ```
    [Install]
    WantedBy=multi-user.target
    ```
    4. Enable the server: `systemd enable foo.service`

  11. @houtianze houtianze created this gist Sep 21, 2016.
    11 changes: 11 additions & 0 deletions sysv.init.script.to.systemd.unit.file.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    Let's say the `SysV Init Script` is called foo (the file `/etc/init.d/foo`):

    1. Start the service through Systemd: `systemctl start foo`
    2. systemd-sysv-generator will generate this file `/run/systemd/generator.late/foo.service`, copy this file to `/etc/systemd/system` by running: `cp /run/systemd/generator.late/foo.service /etc/systemd/system/foo.service`
    3. Edit `/etc/systemd/system/foo.service` by running `systemctl edit foo.service`, add in the following line to `foo.servie` (this makes the service installable)
    ```
    [Install]
    WantedBy=multi-user.target
    ```
    4. Enable the server: `systemd enable foo.service`