Results 1 to 3 of 3

Thread: how to start bash script application on boot in Opensuse Leap 15

  1. #1

    Question how to start bash script application on boot in Opensuse Leap 15

    we have a utility we want to run on startup. in terminal we run it with "sudo ./xxxxx" where xxxx is the application.
    We have tried Gnome Utility Tweaker but that doesn't give us the ability to start a bash script.
    How do we do this? Thanks!!!!

  2. #2
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    26,518
    Blog Entries
    15

    Default Re: how to start bash script application on boot in Opensuse Leap 15

    Quote Originally Posted by rsebok View Post
    we have a utility we want to run on startup. in terminal we run it with "sudo ./xxxxx" where xxxx is the application.
    We have tried Gnome Utility Tweaker but that doesn't give us the ability to start a bash script.
    How do we do this? Thanks!!!!
    Hi and Welcome to the Forum
    You can create a simple systemd service file pointing at your script in
    /etc/systemd/system called say script001.service containing;

    Code:
    # /etc/systemd/system/script001.service
    #
    
    [Unit]
    Description=Run my boot script
    
    [Service]
    Type=oneshot
    ExecStart=/bin/sh -c "/path/to/script/scriptname"
    
    [Install]
    WantedBy=multi-user.target
    Once that's saved, you can run, check and enable;

    Code:
    systemctl start script001.service
    systemctl status script001.service
    {if all ok}
    systemctl enable script001.service
    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!

  3. #3
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    2,478

    Default Re: how to start bash script application on boot in Opensuse Leap 15

    Alternatively, if it's a “system thing”, you can use cron to to the job:
    1. Drop a cronjob file owned by the user who is to execute the command at boot time in ‘/etc/crond.d/’.
    2. Make sure that only the user has the write permission for the file.
    3. Content is something like this:

    Code:
    #
    # No e-Mail
    MAILTO=""
    #
    @reboot «User name» «Command or script to be executed … »
    #
    The Man page is: (5) crontab.

Posting Permissions

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