Unix/Linux Go Back    


Shell Programming and Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and shell scripts and shell scripting languages here.

Auto run script on USB device

Shell Programming and Scripting


Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 10-19-2010
cbreiny cbreiny is offline
Registered User
 
Join Date: Oct 2010
Last Activity: 8 February 2011, 5:49 PM EST
Posts: 17
Thanks: 4
Thanked 0 Times in 0 Posts
Auto run script on USB device

Okay I want to write a script that I put on a jump drive. And when you plug the USB in this script executes. How would i go about doing this? I don't care what the program does right now. I just want to know how this would be done. Any ideas?
Sponsored Links
    #2  
Old Unix and Linux 10-19-2010
Chubler_XL's Unix or Linux Image
Chubler_XL Chubler_XL is offline Forum Staff  
Moderator
 
Join Date: Oct 2010
Last Activity: 27 April 2015, 5:12 PM EDT
Posts: 3,138
Thanks: 121
Thanked 1,032 Times in 966 Posts
Will the computer your intending to run this from have a shell to execute your script? If not you will need to put a copy of the shell on the USB drive too.

Use autorun.inf:


Code:
[autorun]
open=ksh -c myscript
action=Invoke MyScript in ksh shell
icon=myscript.ico
label=My USB Application

Note: This is a popular way for viruses to propagate themselves, so a lot of computers are now setup to not autorun USB devices. This may mean you user will still need to manually start the script so it's probably best to put a shortcut that does that for them (eg Setup.lnk or Install.lnk).
Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Unix or Linux Image More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to Install jdk.bin using shell script with auto yes/no? sandeepbharmori Shell Programming and Scripting 6 03-08-2010 08:15 AM
Script to auto restart a service ajazshariff HP-UX 2 02-19-2010 02:26 AM
auto login script mohankasi Windows & DOS: Issues & Discussions 1 02-03-2009 05:23 AM
Auto answer ( Yes or No) from unix script Nayanajith Shell Programming and Scripting 3 08-22-2006 01:29 AM
Auto Alias Script coolboarderguy Shell Programming and Scripting 3 12-25-2005 08:11 AM



All times are GMT -4. The time now is 03:49 PM.