Cleaner Than Before RHEL7 -> Run Script At Startup

Home » General » Cleaner Than Before RHEL7 -> Run Script At Startup
General 1 Comment

Hello,

thank you for your quick answer.

You are completely right with this:

because they die away in case of network errors and reboots

my script contain Reverse SSH Tunnel:
[root@lab3 system]# cat /opt/ssh_tunnel.sh
#!/bin/bash ssh -f -N -R 12345:localhost:22 root@158.216.189.170

So as I understood from your explanation, I can do it in two different ways.

*First way: *
To create systemd-unit with path to existing script:

[Unit]

*Second way:*
To create systemd-unit with all configuration inside.

[Unit]

But in First Way I don’t see this records:

Restart=always

So that means that my tunnel will die from time to time. (because network failure or something like that)
And i see difference in this record (I will try to learn about it):

Type=oneshot

So this means that the best practice is to use *Second Way* described by you?

PS: Sry for double sending


*בברכה, *
*אלכס ברבר*

*+9 72 54 285 952 3*
*www.linuxspace.org*
*–*
*Best regards.*
*Alex Berber*
*+9 72 54 285 952 3*
*www.linuxspace.org*

One thought on - Cleaner Than Before RHEL7 -> Run Script At Startup