Sponsored Content
Top Forums Shell Programming and Scripting Help with Shell Script opening and closing a program Post 302838061 by Don Cragun on Sunday 28th of July 2013 10:05:45 PM
Old 07-28-2013
Quote:
Originally Posted by plsbbg
REALLY new to this stuff, sorry.

So I want a shell script to open a program, wait 45 minutes, close it, and then do it all again. I want to do this because I am running an iMacros Script for a long period of time and if Firefox is not constantly restarted, memory leaks start to happen.

Anyway heres my script:

Code:
#!/bin/sh
while :
do
'/usr/lib64/iceweasel/iceweasel imacros://run/?m=macro.iim' &
sleep 5
'/usr/lib64/iceweasel/iceweasel imacros://run/?m=macro.iim' &
sleep 2700
killall firefox-bin
done

When I open it using "sh /root/whatever.sh" I get this error:
"line 12: syntax error near unexpected token 'done'"
"line 12: done"

Can anyone help? thanks!

edit: oh yeah, for anyone who isnt familiar to iMacros scripting, running the macro twice after 5 seconds is needed because firefox is not properly loaded during this time
If you're saying that it takes firefox 5 seconds to load before you can run your iMacros script; why not start firefox, sleep 5 seconds, and then launch your iMacros script instead of starting the script twice when you know the first one will fail and maybe leave firefox in an "unknown" state.

The error messages you're getting are from line 12 in some script that isn't identifying itself. Since there are only 9 lines in the shell script you're showing us, this script isn't producing the error. Could the error message be coming from the iMacros script that is failing to start properly?

Rather than killing firefox, it would be much better to debug your iMacros script to stop leaking memory.

What do you see if you run the command:
Code:
'/usr/lib64/iceweasel/iceweasel imacros://run/?m=macro.iim'

at a time when firefox is not running?

What do you see if you run the same command when firefox is running?

What does your iMacros script look like?
 

10 More Discussions You Might Find Interesting

1. Post Here to Contact Site Administrators and Moderators

Requests for Opening/Closing Threads

Please send an email to the administrator(s) of the board with thead ID and forum for any thread that is closed that you want open (or open that you want closed). All requested considered. Our apologies if sometimes threads are closed early. If this happens, please email :) Nobody is perfect... (0 Replies)
Discussion started by: Neo
0 Replies

2. Post Here to Contact Site Administrators and Moderators

Opening and closing threads

Hi all, Just thought I'd mention something I've noticed since joining this forum :) Would it be a good idea to close threads once the initial question that was posted has been answered? I notice a few posts where people go on and on and as soon as you post a reply to one question they... (2 Replies)
Discussion started by: _Spare_Ribs_
2 Replies

3. Shell Programming and Scripting

Getting Following problem when opening shell script (Very Urgent)

Hi All, Actually when i am trying to open my shell script file 1.sh then i am getting the following error. > vi 1.sh "/var/tmp/ExdNaarK" No space left on device Can anybody tell me that how to rectify it. It is very urgent. Because i am not able to do any work due to the above error. ... (1 Reply)
Discussion started by: sunitachoudhury
1 Replies

4. Shell Programming and Scripting

closing a telnet session on error, in a shell script

I am using a shell script to telnet into a remote unix server and execute certain commands. But if any command being executed remotely, throws an error, the script just hangs. And the telnet session does not get closed. I want to be able to close the session and complete the script execution in... (1 Reply)
Discussion started by: farahzaiba
1 Replies

5. Shell Programming and Scripting

Finding opening and closing braces

I am reading a cpp file thru shell script . There are many fuctions inside the cpp file eg pvvd_fncn_name1 { ..... something } pvvd_fncn_name2 { ..... something } what I require is a method to find the first opening brace and the coresponding last brace and search... (2 Replies)
Discussion started by: ultimatix
2 Replies

6. OS X (Apple)

Opening and Closing Shares via ssh

Might anyone have an idea on how to mount an xserve share via ssh, then close the share connection? (3 Replies)
Discussion started by: unimachead
3 Replies

7. Shell Programming and Scripting

Help with opening another file from within a shell script

Hi, I am trying to open a file that I have created from withn a shell script and cannot seem to get it working. Does anyone have any ideas? Thanks. (2 Replies)
Discussion started by: tdsrogers
2 Replies

8. Shell Programming and Scripting

Opening Child Shell & Executing a script in the same context

Hi, Is the below possible (SHELL = tcsh)? -- I want to write an 'alias' something like this - alias set_my_work "setenv SOME_VAR;tcsh -i;source work_script.cshrc" The intention is to run this alias and enter a child shell, at the same time ensuring that the work_script.cshrc is source-ed.... (0 Replies)
Discussion started by: mishra.a.c
0 Replies

9. Shell Programming and Scripting

Print a closing XML tag shell script

I have a shell script that does everything I need it to do. But, when I was testing it I realized it doesn't print the closing XML tag.... Does anyone know how to incorporate printing the XML tag with my script? I am using AWK any help would be appreciated. (4 Replies)
Discussion started by: risarose87
4 Replies

10. Shell Programming and Scripting

Script Works But Need It to Exit Upon Closing Program

Running Xubuntu 16.04 with shell version "GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)," I have a working script that consistently renames a Chrome window: #!/bin/sh while sleep 1; do xdotool search --name chrome 2>/dev/null | while read id; do xdotool set_window --name... (21 Replies)
Discussion started by: jakefish
21 Replies
FIREFOX(1)							Linux User's Manual							FIREFOX(1)

NAME
firefox - a Web browser for X11 derived from the Mozilla browser SYNOPSIS
firefox [OPTIONS] [URL] DESCRIPTION
Mozilla Firefox is an open-source web browser, designed for standards compliance, performance and portability. USAGE
firefox is a simple shell script that will set up the environment for the actual executable. OPTIONS
A summary of the options supported by firefox is included below. GTK options --gdk-debug=FLAGS Gdk debugging flags to set --gdk-no-debug=FLAGS Gdk debugging flags to unset --gtk-debug=FLAGS Gtk+ debugging flags to set --gtk-no-debug=FLAGS Gtk+ debugging flags to unset --gtk-module=MODULE Load an additional Gtk module X11 options --display=DISPLAY X display to use --sync Make X calls synchronous --no-xshm Don't use X shared memory extension --xim-preedit=STYLE --xim-status=STYLE --g-fatal-warnings Make all warnings fatal Firefox options -h, -help Show summary of options. -height value Set height of startup window to value. -width value Set width of startup window to value. -v, -version Print /usr/bin/firefox-bin version. -CreateProfile profile Create profile. -P profile Start with profile. -ProfileManager Start with profile manager. -UILocale lang-region Start with lang-region resources. -contentLocale lang-region Start with lang-region resources. -remote command Execute command in an already running Firefox process. For more info, see: http://www.mozilla.org/unix/remote.html -no-remote Don't try to control an already running instance. -jsconsole Start with Javascript Console -chrome url Load the specified chrome. -new-window url Open URL in a new window if Firefox is already running. -new-tab url Open URL in a new tab if Firefox is already running. -preferences Open Firefox preferences menu. -safe-mode Disables extensions and themes for this session. FILES /usr/bin/firefox - shell script wrapping firefox /usr/lib/firefox/firefox - firefox executable VERSION
3.0 BUGS
To report a bug, please visit http://bugzilla.mozilla.org/ SEE ALSO
mozilla(1) AUTHORS
The Mozilla Organization http://www.mozilla.org/about.html firefox January 04, 2006 FIREFOX(1)
All times are GMT -4. The time now is 01:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy