I need help regarding my .sh File (ScreenShot in Ubuntu)

Asked by Joel Kabigting on 2010-09-23

I just follow this instructions that I saw in the NET It's work fine .

my inquiry is I need to know how can I make this script file automatically run when I boot up my linux ubuntu and for every user who login on our computer.

Sample Shell Script for taking screen shot at regular interval for 24 hours( Every 5 Minutes)
#vim capture.sh
for((i=0;i<24;i++))
do
import -window root screen_$i.png
sleep 5m
done

Hope somebody could help me regarding this matter.

Joel
<email address hidden>

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu bash Edit question
Assignee:
No assignee Edit question
Last query:
2010-09-28
Last reply:
2010-09-28

i="0"
while [ $i -lt 288 ]
do
import -window root screen_$i.png
i=$[$i+1]
sleep 300
done

Should do it.

Hi thanks for the quick response, regarding my inquiry I'm ok with this script that I saw in the NET all I need to know is how can I make this script file automatically run when I boot up my LINUX , and for every user who will login on this particular pc will run this script file

#vim capture.sh
for((i=0;i<24;i++))
do
import -window root screen_$i.png
sleep 5m
done

Thanks

Incidentally, the file extension is moot, you don't need the file extension. If a text file is marked as executable it will be a scipt. Windows relys on the file extension to identify the file type, Linux looks at the data to determine what the file is

Hi actionparsnip , where should I create this script ? what file name should I create? or I just need to add this on a ready Script file ?

i="0"
while [ $i -lt 288 ]
do
import -window root screen_$i.png
i=$[$i+1]
sleep 300
done

Should do it.

Thanks
Joel

You can create it or call it whatever you like. If you put it in /usr/bin and give it an obscure name then it will be accessible like the other commands in your OS.

You will also need to run:

chmod +x file

to make the file executable. If you want me to fully tell you then run:

gksudo gedit /usr/bin/takesomescreenshots; sudo chmod +x /usr/bin/takesomescreenshots

Paste in the text, save file and close gedit

You can now run:

takesomescreenshots

and it will run as you expect.

Hi,
  Sorry but still I need your assistance honestly I'm newbie in Linux Ubuntu I was able to create the script that you gave it to me. it's also run when I type this on the terminal screen, as per your advice all the command that you gave I just follow the instruction but still it doesn't run automatically when I boot up my linux.
when I save the script that you gave the file is only a plain text documents and it did not run automatically when restart my computer. It just run when I type it on my terminal screen.

Hope you could assist me again on this matter I really need this badly...

Thanks
Joel

Then add it in your startup items
http://www.howtogeek.com/howto/ubuntu/how-to-add-a-program-to-the-ubuntu-startup-list-after-login/

You could have found a guide like that using websearches really easily and got you on your way.

Hi,
    Good Day, regarding my inquiry I follow all the instruction you gave but sorry until now. it did not work. when I boot up my computer the scripts did not run. even I put it on the system - preferences - startup Application options.

maybe I made some mistake on the procedure. hope you still help me on this issue..

Thanks

Joel

the screen shot script file you gave is working fine. but did run on startup or even when I login my user.

Thanks
Joel

If you make a new startup entry and reference the file in the new item it will startup. You may need to add a sleep at the start to delay the execution of the meat of the script.

If you put:

sleep 60

on the line above:

i="0"

then it will give the OS 1 minute to get settled before running the script.

Can you help with this problem?

Provide an answer of your own, or ask Joel Kabigting for more information if necessary.

To post a message you must log in.