1

I am trying to get a GNU/Linux Bash script to run as soon as a network connection is established on my Raspberry Pi. I tried following the instructions on several pages:

I have tried adding my script to /etc/network/if-up.d and running sudo chmod ugo+x on the file.

I have tried adding the line post-up <path/to/script.sh> to /etc/network/interfaces

I am really quite clueless here.

More info:

The script runs fine when manually run, here it is: http://pastebin.com/UJvt5HYU (I did remove my personal info (email addresses, passwords), but other than that, the script is unchanged. This script also uses the sendEmail program (can be found at http://caspian.dotconf.net/menu/Software/SendEmail/).

2
  • We cannot help you if you don't show us the relevant files. Please post your script's code. Does it run OK if you run it manually? Are you using a full path or a relative one? Please always include all the relevant files in your question.
    – terdon
    Nov 8, 2013 at 3:10
  • Can you make the script log to a file so that you can see what the script is trying to do, and what it fails on ? Also, have you tried putting the script into /etc/network/if-up.d but make sure it has no file extension ?
    – Lawrence
    Nov 8, 2013 at 5:10

2 Answers 2

1

I was able to solve this by putting the script into /etc/network/if-up.d/ with no extension.

0

I have a .desktop file in ~/.config/autostart that executes a python email script, which looks like this:

[Desktop Entry]
Name=EmailOnBoot
Exec="python ~/Path/To/SendEmail.py"
Type=Application

If you dont have ~/.config/autostart you can just create it, and make the file.desktop in it executable. It executes after everything else including network connection (WiFi in my case).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .