🦲
mind
  • cleber's mind
  • plans
    • fact checking
    • personal assistant
  • self-management
    • agenda and tasks
    • mails and emails
  • knowledge
    • career
    • programming
      • Big O Notation
      • browsing data
      • C/C++
      • databases
      • eclipse
      • gradle
      • java
        • apache camel
      • javascript
      • naming convention
      • mysql
      • prolog
      • regex
      • REST
      • ssl/tls
      • version control
        • git commands
      • web-semantics
      • wot
    • research
      • mas
      • planning
      • math
        • probability
      • machine learning
      • nlp
      • speech recognition
      • data sources
      • data visualisation
    • it
      • asterisk
      • containers
        • installing docker
        • deploying busybox
        • deploying a sample
        • deploying node-red
        • deploying from the hub
      • clusters
        • installing kubernetes
        • deploying bootcamp
        • deploying nginx
        • deploying jacamo-rest
        • grafana
      • deploy
        • heroku
      • linux
        • tmux
        • vim
        • startup
      • networks
      • pdf
        • ssh
    • productivity
    • language
      • expressions
        • nice signposts
        • linking expressions
      • latex
      • scientific
      • writing
    • sailing
    • financial
      • assets
    • emergency
    • out of boxes
  • teaching
    • eletrônica digital
      • Conversão decimal para binário
      • Conversão binário para decimal
      • Sinais analógicos vs digitais
    • programação I
    • cabeamento estruturado
  • moments
    • insightful ai facts
    • ai4industry-hackathon
    • previous activities
  • brasil
  • external links
    • personal webpage
    • my github
Powered by GitBook
On this page
  • Adding commands at startup
  • Write a script placing it at /etc/init.d/
  • Make it executable
  • Test it on start and on stop
  • Add the script on startup

Was this helpful?

  1. knowledge
  2. it
  3. linux

startup

linux startup

PreviousvimNextnetworks

Last updated 5 years ago

Was this helpful?

Adding commands at startup

In Debian GNU/Linux 9.12 (stretch) with I have tried several ways to add a script after login and unlocking screen and none of them has worked. It seems adding a .desktop file on ~/.config/autostart/ should work. But even doing that by xfce "Session and startup" interface and having sure that the script is runnable is did not worked in any situation (unlocking, login and even startup). What really works is by /etc/init.d/ that I did as follows:

Write a script placing it at /etc/init.d/

#! /bin/sh
# /etc/init.d/myautostart

### BEGIN INIT INFO
# Provides:          myautostart
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: My autostart actions
# Description:       My autostart actions
### END INIT INFO

case "$1" in
  start)
    echo "Starting myautostart..."
    # execute a script in my home folder
    /home/myuser/myscript.sh
    ;;
  stop)
    echo "Stopping myautostart..."
    # do something
    ;;
  *)
    echo "Usage: /etc/init.d/myautostart {start|stop}"
    exit 1
    ;;
esac

exit 0

Make it executable

$ sudo chmod +x /etc/init.d/myautostart

Test it on start and on stop

$ sudo /etc/init.d/myautostart start
$ sudo /etc/init.d/myautostart stop

Add the script on startup

$ sudo update-rc.d myautostart defaults

To remove it from startup just run $ sudo update-rc.d -f myautostart remove

Source:

xfce
stuffaboutcode.com