Results 1 to 8 of 8

Thread: How to autostart DX Spider in SUSE 12.3

  1. #1
    Join Date
    Mar 2013
    Location
    Near Anchorage
    Posts
    3

    Default 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

  2. #2
    Join Date
    Mar 2010
    Location
    Austin - Texas
    Posts
    10,140
    Blog Entries
    48

    Smile Re: How to autostart DX Spider in SUSE 12.3

    Quote Originally Posted by AK_Bob View Post
    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?

    Code:
    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,
    My Blog: https://forums.opensuse.org/blogs/jdmcdaniel3/

    Software efficiency halves every 18 months, thus compensating for Moore's Law

    Its James again from Austin, Texas

  3. #3
    Join Date
    Mar 2013
    Location
    Near Anchorage
    Posts
    3

    Default Re: How to autostart DX Spider in SUSE 12.3

    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.

  4. #4
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    26,655
    Blog Entries
    15

    Default Re: How to autostart DX Spider in SUSE 12.3

    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

    Code:
    # /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;
    Code:
    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?
    Last edited by malcolmlewis; 18-Mar-2013 at 17:11.
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

  5. #5
    Join Date
    Mar 2010
    Location
    Austin - Texas
    Posts
    10,140
    Blog Entries
    48

    Smile Re: How to autostart DX Spider in SUSE 12.3

    Quote Originally Posted by AK_Bob View Post
    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.
    OK, what about this terminal command?

    Code:
    /usr/bin/su -c "/usr/bin/perl -w /spider/perl/cluster.pl" sysop >/dev/tty7
    Thank You,
    My Blog: https://forums.opensuse.org/blogs/jdmcdaniel3/

    Software efficiency halves every 18 months, thus compensating for Moore's Law

    Its James again from Austin, Texas

  6. #6
    Join Date
    Mar 2013
    Location
    Near Anchorage
    Posts
    3

    Default Re: How to autostart DX Spider in SUSE 12.3

    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

  7. #7
    Join Date
    Mar 2010
    Location
    Austin - Texas
    Posts
    10,140
    Blog Entries
    48

    Smile Re: How to autostart DX Spider in SUSE 12.3

    You could give this a try:

    Code:
    
    # /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,
    My Blog: https://forums.opensuse.org/blogs/jdmcdaniel3/

    Software efficiency halves every 18 months, thus compensating for Moore's Law

    Its James again from Austin, Texas

  8. #8
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    26,655
    Blog Entries
    15

    Default Re: How to autostart DX Spider in SUSE 12.3

    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


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •