element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum raspberry pi sakis3g software script for automatic startup
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 8 replies
  • Subscribers 666 subscribers
  • Views 1840 views
  • Users 0 members are here
Related

raspberry pi sakis3g software script for automatic startup

Former Member
Former Member over 12 years ago

guys, I wanted to run sakis 3g automatically on startup. I have already written the code for configuration using sudo nano /etc/sakis3g.conf.

 

 

Whenever I type sudo ./sakis3g connect, the usb modem gets connected within a minute.

Now, I want this command to be executed on the boot up of the raspberry pi.

 

 

So, I tried adding this command " sudo ./sakis3g connect " to rc.local, it did not work.

 

 

So , I wrote this script below which also did not work .

 

 

1st, I executed sudo nano /etc/init.d/sakis3g

 

 

[code]

#! /bin/sh

# /etc/init.d/foobar

 

 

# The following part always gets executed.

echo "This part always gets executed"

 

 

# The following part carries out specific functions depending on arguments.

case "$1" in

  start)

    sudo ./sakis3g connect

    motion

    ;;

  stop)

    sudo ./sakis3g disconnect

    echo "camera is dead"

    ;;

  *)

    echo "Usage: /etc/init.d/sakis3g {start|stop}"

    exit 1

    ;;

esac

 

 

exit 0

 

 

[/code]

 

 

I have also included motion command above in order for the motion software to start on bootup.

 

 

After this I executed these two commands .

 

 

sudo chmod 755 /etc/init.d/sakis3g

sudo chown root:root /etc/init.d/sakis3g

 

 

The internet is not getting connected.

I have to do it manually by typing  sudo ./sakis3g connect for it to connect.

Please help with this script.

  • Sign in to reply
  • Cancel
  • shabaz
    shabaz over 12 years ago

    Not that I've done this, but generally you should put the entire path to the file in your script, i.e. not ./sakis.. but instead something like /usr/local/bin/sakis.. (or wherever it is located).

    Also, you may not need the 'sudo' in your script. Finally, it's worth checking to see if the /<path>/sakis3g (whatever that is) is a script too, or an executable. If it is a script, check that too, to ensure it's not relying on environment variables that may not exist at startup.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to shabaz

    Sir, sakis3g is an executable file. Thats why I tried putting the sudo command in the script. When I enter the command sudo ./sakis3g manually, it gets connected. So , in order for it run automatically I wrote it in the script.

     

    Sir, what changes should I do now in the script ???

     

    Could please specify?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • shabaz
    shabaz over 12 years ago in reply to Former Member

    The dot signifies current folder. Executables don't sit in /etc/xx so having a dot in the script is not a good idea - how will the script know which folder you mean?

    Tha's why you need to put the entire path as described earlier.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to shabaz

    Sir, I am a newbie! Dont have much knowledge abt scripts.

     

    I included the command "sudo ./sakis3g connect" in the script , and not the location of the folder that sakis is in.

     

    I wanted this command to be executed on boot up, and so I included this in a script.  (this command worked well when I typed it in manually in the command window)

     

    I hope you got my point and idea.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • shabaz
    shabaz over 12 years ago in reply to Former Member

    I do get your point. But, as mentioned, just because it works on the command line with a dot doesn't mean that's the case from a script. You need to locate where the software is installed (e.g. /usr/local/bin) and put the entire path in your script.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • bprewit
    bprewit over 12 years ago in reply to shabaz

    I think what you're looking for is:

    1) move your sakis3g script to somewhere publicly accessible (/usr/local/bin would be the traditional location).  It's a good idea to set the owner to root and the permissions to read-only for everyone else (ie, chmod 755 /usr/local/bin/sakis3g).

    2) add a line such as "/usr/loca/bin/sakis3g" to your /etc/rc.local

     

    That should cause your script to be executed on each reboot.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • gdstew
    gdstew over 12 years ago in reply to bprewit

    I think you want to add the /usr/local/bin/sakis3g line to:

     

    /etc/init.d/rc.local

     

    instead of:

     

    /etc/rc.local

     

    /etc/init.d/rc.local is one of the last start up scripts run by init from the run level directories (/etc/rc2.d, /etc/rc3.d, etc).

     

    I' not sure if or when /etc/rc.local is run (user login ?).

     

    Edited to add:

     

    I just did some checking and /etc/rc.local is run at system initialization (by /etc/init.d/rc.local) so the original instructions

    should work. I know I tried using /etc/rc.local before to create the link /dev/ttyS0 for the Raspberry Pi serial device /dev/ttyAMA0

    and it didn't work until I moved it to /etc/init.d/rc.local. At the time I had no idea why it didn't work, and I still don't. Permissions ?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to bprewit

    Thanks a lot sir!

     

    It works perfectly now!

     

    You rock!!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube