Executing Maven task from shell script and getting error codes
location: linuxexchange.com - date: March 21, 2014
I'm executing a Maven deploy task from a bash script however even if the Maven task fails the script will continue and complete without errors.
I have tried the -e flag but that causes the deploy to fail. I also tried the following (pseudo code)
result_code= mvn deploy
if [$result_code -gt 0];then
Any suggestions how i can identify if the deploy was successful?
Calling script from shell script getting command not found
location: linuxexchange.com - date: January 25, 2012
I am new to shell scripting. I am trying to work through this.
> script to execute in cron (util.sh)
(I also tried source /mnt/stor/backups/backup.sh)
> script to execute (backup.sh)
When backup.sh is called (it does get called) it appears to simply be parsed and not executed. So no matter what I put in it I get messages like:
/mnt/stor/backups/backup.sh: line 8: date: command not found
/mnt/stor/backups/backup.sh: line 8: mysqldump: command not found
/mnt/stor/backups/backup.sh: line 8: tar: command not found
/mnt/stor/backups/backup.sh: line 8: rm: command not found
The idea is to have a domain localized file, execute it with variables, and call a master script that uses the variable to do the dirty work. Because of limitations with one of my hosts and multiple domains this is the best method.
executing konsole from shell script
location: linuxquestions.com - date: April 19, 2004
I'm making the transition from Windows to Linux (Mandrake 9.2). Right now I'm trying to make a script I can doubleclick from my linux desktop that opens a console window (konsole) and then issues a command (defined in the script) to this window. In Win(DOS) this would require a batch file with a wait statement (to prevent the command prompt from closing after the command was issued). In Linux my script works if I type it from within an active Konsole session, but if I click a link from the desktop, or click the file name within its directory from Konqueror nothing seems to happen. If I make the script executable I get the error 'Couldn't find the program <myscriptname.sh>'.
Is what I'm trying possible from a script or am I taking the wrong approach?
Automatic exit from bash shell script on error
location: linuxexchange.com - date: March 29, 2015
I've been writing some shell script and I would find it useful if there was the ability to halt the execution of said shell script if any of the commands failed. See below for an example:
So in this case if the script can't change to the indicated directory then it would certainly not want to do a ./configure afterwards if it fails.
Now I'm well aware that I could have an if check for each command (which I think is a hopeless solution), but is there a global setting to make the script exit if one of the commands fails?
Linux based java decompiler to be called from shell script
location: linuxquestions.com - date: June 25, 2009
I am writing a shellscript in which I want to obtain original Javacode from a bulk of jar files.I am unjaring them successfully and then I have to decompile the class files to obtain the original java code.
While using "javap" from shellscript I am not getting the complete java code.Therefore I have to use some other Linux based java decompiler which can be called from shellscript to perform the bulk decompilation.
Please provide me with some Linux based decompiler(preferably freeware) which I can call from shell-script to act upon my class files.
csh Shell Script: Getting wc command output to variable to do math on it, how?
location: linuxquestions.com - date: May 4, 2009
A quick CSH question. I'm trying to run wc -l on a file. I want to get this line count on to a variable in my csh script. I'm not doing it right.
This is what i've tried to no avail:
scp from shell script using cron
- date: October 12, 2010
I have a script that I would like to run using 'cron'. I want to use 'scp' to transfer files from one machine to another. I have set up the SSH keys on both machines. When I run the script from bash terminal, it works flawlessly. But when I schedule a 'cron' job to run the same script, 'scp' does not transfer the files.
echo "Inside $0"
echo "Time: `date` "
echo "Changing to $HOME/test"
echo "Remotely copying"
scp -v * $host:$directory
echo "Return value: $retvalue"
'Return value' is 0 when the script is run from bash directly. But when it runs from 'cron', the 'Return value' is 1. That means, surely, that 'scp' is throwing an error. I don't know which error is being encountered. Could anybody let me know how to make it work?
Thanks and Regards.
Shell Script: Getting signal handlers to work when running an application by script
location: linuxquestions.com - date: September 13, 2011
Ok my subjetc line doesn't clarify my problem so much i agree... here is detailed problem:
I have an application (App_1) which has to run another application (App_2). I can achieve this through a script (/path/to/App_1 /path/to/App_2) and it works, no problem. But my App_2 has some handlers (like if App_2 is running and i issue a "Ctrl-C" during its run i get the status of App_2, like memory used, time remaining before application will finish its job etc). If i run App_2 independent of App_1, it handles those "Ctrl-C" fine, but when i run it through App_1, "Ctrl-C" handler of App_2 doesn't work and it kills the script while App_2 is still running as if nothing happened.
My problem is that in such case when i run App_2 through App_1, how do i make sure that handlers of App_2 are handled properly.
I hope i have made myself clear...but please let me know if you guys have still some doubt.
remove duplicate lines from shell script
location: linuxquestions.com - date: April 8, 2010
i have a file with semi duplicate lines
abc 12 32
now i want to edit my file and make it:
abc 12 32
i.e. remove second occurrence of line when 1st column is abc or agsi.
[SOLVED] change color of text from shell script
location: linuxquestions.com - date: July 9, 2012
What command (or combination of commands) do I need to use to change the color of the text from within a shell script? My teacher has me creating a menu script where the script asks for input from the user and the user chooses from a menu of options. One of the options is the calendar utility. User can hit #4 and the cal command will run automatically. My problem is that I'm supposed to make the calendar that is printed to the screen green and I cannot for the life of me figure it out...
Page: 1 2 3 4 5 6 7 8 9 10