Choose style:

Author Topic: Trying to get my sh script to run on startup  (Read 73 times)

0 Members and 1 Guest are viewing this topic.

Offline elmington

  • nOOb
  • *
  • Posts: 2
  • Karma: 0
  • New Forum User
    • View Profile
  • Peppermint version(s): 10
Trying to get my sh script to run on startup
« on: August 11, 2019, 07:58:28 am »
Hi Folks

Been at it for hours now. I want a simple script to run on startup. I've tried everything (I think) the script is simple, one short line.

I've created the following script, which works fine manually

#!/bin/bash

xinput map-to-output silead_ts DSI-1


1. I've copied this as an sh file to /home/myuser/.config/autostart           didnt work
2. Created a .desktop file to run the sh script from my home directory, I have placed the desktop file in /home/myuser/.config/autostart   this works fine manually but not at startup
3. I've copied the desktop file to /etc/xdg/autostart/  and /usr/share/applications both with root permissions   this didnt work
4. Tried created an entry in the crontab file, this didnt work either

At a loss here folks, can someone help me please.

Cheers!!





Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 25288
  • Karma: 2793
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 8R, 9, and 9R
Re: Trying to get my sh script to run on startup
« Reply #1 on: August 11, 2019, 01:59:47 pm »
Try this:
Code: [Select]
xed ~/.config/autostart/map-to-output.desktop
when a blank file opens, make it read:
Code: [Select]
[Desktop Entry]
Type=Application
Name=map-to-output
Comment=map-to-output
Exec=bash -c "sleep 5 ; xinput map-to-output silead_ts DSI-1"
Terminal=false
SAVE the file.

Log off/on to test.



I added a 5 second delay (sleep 5) in case the issue is a timing issue/race condition.
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline VinDSL

  • Global Moderator
  • Hero
  • *****
  • Posts: 5181
  • Karma: 939
  • Peppermint Mod
    • View Profile
  • Peppermint version(s): Developmental Builds
Re: Trying to get my sh script to run on startup
« Reply #2 on: August 11, 2019, 02:38:54 pm »
I added a 5 second delay (sleep 5) in case the issue is a timing issue/race condition.

Good idea, Chief!

There are any number of autostart scripts that require a wait-state.

Conky, Dropbox, and MegaSync come to mind, on the machine I'm using right now.  Without adding wait-states, and having them autostart at different times, and in a different order, it would be a complete train wreck.

Just saying...   ;)

Offline elmington

  • nOOb
  • *
  • Posts: 2
  • Karma: 0
  • New Forum User
    • View Profile
  • Peppermint version(s): 10
Re: Trying to get my sh script to run on startup
« Reply #3 on: August 13, 2019, 02:29:42 pm »
HI Chaps

Thanks for the replies, unfortunately this didn't work. hmmmmmmmmm

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 25288
  • Karma: 2793
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 8R, 9, and 9R
Re: Trying to get my sh script to run on startup
« Reply #4 on: August 13, 2019, 02:37:59 pm »
what's the output from:
Code: [Select]
ls -l ~/.config/autostart
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec