How to autostart DX Spider in SUSE 12.3

I’m looking for an FAQ or info on how the auto start an application after a reboot (say coming back up after a power outage).

My application is written in Perl and I had it running 24/7 in older versions of SUSE 9 and 10. I am now using SUSE 12.3.

The application is called DX Spider (a ham radio application but no RPM). The method I used to autostart the application was with the following line in /etc/inittab:
DX:235:respawn:/bin/su -c “/usr/bin/perl -w /spider/perl/cluster.pl” sysop >/dev/tty7

How do I accomplish this in SUSE 12.3? Adding the above line to /etc/inittab appears to do nothing - at perl app does not start up after a reboot.
Thanks for the help (or telling me where to look).

Bob

So can you execute the following command in terminal and it works?

DX:235:respawn:/bin/su -c "/usr/bin/perl -w /spider/perl/cluster.pl" sysop >/dev/tty7

Must you be root or does it run as a standard user?

For root authority, you can add a command line to be ran as root to the file /etc/init.d/boot.local. It is possible to add a line to a bash script you own and have it ran when you log in as a normal user. The locations differ between KDE and GNOME, so we need to know the desktop that you are using.

You can edit any system file using this bash script: SYSEdit - System File Editor - Version 1.50 - Blogs - openSUSE Forums

You can create your own bash script with this: N.S.F. - New Script File, Bash Script File Header Creator - Version 3.0 - Blogs - openSUSE Forums

You can make the after.local script working with this: systemd and using the after.local script in openSUSE 12.3 - Blogs - openSUSE Forums

Thank You,

Thanks for the suggestions. If I type as root the text in a terminal I get “now such file or directory” /bin/su

Either the owner or root can start the perl application. But it is best to run it as the owner to avoid potential security issues.

I have installed sysedit and will do the others you suggested as well. If I understand this, I need a bash script to start this app after a power cycle (when I am unavailable to enter any commands). So the script is run as root during boot up (in after.local), but I want it to execute as the owner. Still not sure exactly how to do this, but I’ll keep learning.

Hi
If you have a look at my systemd-htop-service, it should set you on the right track for creating your own service file;
https://github.com/malcolmlewis/systemd-htop-service


# /usr/lib/systemd/system/dxspider.service
#
# Copyright (c) 2013 <yourname>
#


[Unit]
Description=


[Service]
Type=simple
Environment=TERM=linux
User=DX
TTYPath=/dev/tty7
ExecStart=/bin/sh -c "/usr/bin/perl -w /spider/perl/cluster.pl" sysop > /dev/tty7 < /dev/tty7
Restart=always
RestartSec=0
TTYReset=yes
TTYVHangup=yes
TTYVTDisallocate=yes
KillSignal=SIGHUP


[Install]
WantedBy=multi-user.target

Save it as dxspider.service in /usr/lib/systemd/system/ and reload systemd;


systemctl --system daemon-reload
systemctl start dxspider.service
systemctl status dxspider.service

You will probably also need to add a udev rule for user DX to own the tty, does it need to be 7?

OK, what about this terminal command?

/usr/bin/su -c "/usr/bin/perl -w /spider/perl/cluster.pl" sysop >/dev/tty7

Thank You,

James,
Thanks for the script. I was away for awhile and just got back to working this problem. The script starts the dxspider.service via systemctl start/status. The service starts automatically if I shut it down normally - perfect. However, it does not start the service after a reboot. I noticed there is a lock file and if it exists, the perl script will not start. So now I need to be sure to remove the lock file when bringing up the service. Can I do that in dxspider.service script, before the ExecStart statement? Can I add the following line: rm /spider/local/cluster.lck

Here’s the script today:

/usr/lib/systemd/system/dxspider.service

Copyright (c) 2013 Bob Engberg

[Unit]
Description=DXSpider Cluster

[Service]
Type=simple
Environment=TERM=linux
User=clstr_admin
TTYPath=/dev/tty7
ExecStart=/bin/sh -c “/usr/bin/perl -w /spider/perl/cluster.pl” clstr_admin > /dev/tty7
Restart=always
RestartSec=0
#TTYReset=yes
#TTYVHangup=yes
#TTYVTDisallocate=yes
KillSignal=SIGHUP

[Install]
WantedBy=multi-user.target

You could give this a try:


# /usr/lib/systemd/system/dxspider.service
#
# Copyright (c) 2013 Bob Engberg
#


[Unit]
Description=DXSpider Cluster


[Service]
Type=simple
Environment=TERM=linux
User=clstr_admin
TTYPath=/dev/tty7
**ExecStartPre=rm /spider/local/cluster.lck**
ExecStart=/bin/sh -c "/usr/bin/perl -w /spider/perl/cluster.pl" clstr_admin > /dev/tty7
Restart=always
RestartSec=0
#TTYReset=yes
#TTYVHangup=yes
#TTYVTDisallocate=yes
KillSignal=SIGHUP


[Install]
WantedBy=multi-user.target [/QUOTE]

Thank You,

On Tue 02 Apr 2013 10:36:01 PM CDT, AK Bob wrote:

James,
Thanks for the script. I was away for awhile and just got back to
working this problem. The script starts the dxspider.service via
systemctl start/status. The service starts automatically if I shut it
down normally - perfect. However, it does not start the service after a
reboot. I noticed there is a lock file and if it exists, the perl
script will not start. So now I need to be sure to remove the lock file
when bringing up the service. Can I do that in dxspider.service script,
before the ExecStart statement? Can I add the following line: rm
/spider/local/cluster.lck

Here’s the script today:

/usr/lib/systemd/system/dxspider.service

Copyright (c) 2013 Bob Engberg

[Unit]
Description=DXSpider Cluster

[Service]
Type=simple
Environment=TERM=linux
User=clstr_admin
TTYPath=/dev/tty7
ExecStart=/bin/sh -c “/usr/bin/perl -w /spider/perl/cluster.pl”
clstr_admin > /dev/tty7
Restart=always
RestartSec=0
#TTYReset=yes
#TTYVHangup=yes
#TTYVTDisallocate=yes
KillSignal=SIGHUP

[Install]
WantedBy=multi-user.target

Hi
If the change indicated by James works, you should push the systemd
service file upstream to the developers for inclusion.


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 12.3 (x86_64) Kernel 3.7.10-1.1-desktop
up 2 days 2:09, 4 users, load average: 0.06, 0.12, 0.10
CPU Intel® i5 CPU M520@2.40GHz | GPU Intel® Ironlake Mobile