This question already has an answer here:

I am using Arch Linux. I don't have any special permissions, I am just user without any special privileges. I want to start an application after each boot.

I have already tried using crontab jobs, using @reboot . But it's not working.

How to run application at every system boot, (solutions for execution after login is even better).

Additional information: I have tried adding same cron job (using @reboot) job in Ubuntu also, but its also not working.

My crontab job:

@reboot /home/username/get_stats.py

Command should execute after first login after each reboot.

marked as duplicate by jasonwryan, Anthon, jimmij, Timo, slm Jan 3 '15 at 13:24

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • It's not working.... what is not working, why don't you show us your @reboot line by editing your question. Login can happen any number of times after reboot. Do you want something to happen on first login after reboot only, on every login? – Anthon Jan 3 '15 at 9:19
  • Why are you down voting my question Mr. Anthon van der Neut ????????????? – ankith p Jan 3 '15 at 9:30
  • If you hover above the down arrow, you can see the reasons for downvoting. Why do you think I am downvoting this? (And if I could only do that once). – Anthon Jan 3 '15 at 9:32
  • Is your get_stats.py executable? (output of ls -l /home/username/get_stats.py) – Anthon Jan 3 '15 at 9:33
  • Yes, it is executable. -rwxr-xr-x – ankith p Jan 3 '15 at 9:35

You can add a line to your .bashrc file, so that it will be executed after restart and first login:
echo "python /home/username/myscript.py" >> ~/.bashrc

  • This will execute on each and every login after a reboot, not just the first login and that is not what the OP wants. – Anthon Jan 3 '15 at 12:33
  • Whether i should add the line in .bashrc or .bash_profile ? – ankith p Jan 4 '15 at 13:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.