The error-handling tag has no wiki summary.
5
votes
2answers
340 views
Making sure a command has executed in bash
I have a bash file with commands to merge pcap files. I want to know if there is anyway to make sure a line in bash runs or not. Like in windows bat file we have %ErrorLevel% ¨
Say a command
touch -r ...
3
votes
1answer
30 views
chmod + silent mode + how force exit code 0 in spite of error
Is it possible execute chmod and ignore error from command
Example ( remark file.txt not exsist to show the example )
When I type
chmod 777 file.txt
I get error on the output
chmod: cannot ...
3
votes
0answers
68 views
How to implement logwatch functionality on top of systemd journal?
Logwatch scans logfiles with regular intervals, collects errors and stuff, then mails it to the admin. This was back in syslog and logfiles days. What's the corresponding solution for systemd's ...
2
votes
1answer
77 views
How to have a bash script perform a specific action on errors of _each_ command?
Similarly to set -e performs an exit on "uncaught" $? != 0, I'd like to have this event trigger the execution of another command, e.g. a logger call. How can this be done?
4
votes
1answer
228 views
How does Linux md-RAID handle disk read errors?
There are 2 cases:
the read command times out at kernel level (30 seconds by default),
the drive reports its unability to read a given sector before the kernel lose patience (the case I'm ...
3
votes
1answer
64 views
Bash capture any error like -e but don't exit, do something else
I want to set a flag in a shell script (bash) so that if anything returns non-zero, a flag is set (i.e. set a variable like errors="True").
So far, I've thought of calling the script with ...
1
vote
1answer
78 views
Unwanted messages every time I attempt to login?
I am using Linux Mint Olivia and it worked fine for past couple of months but from yesterday it keep showing these message whenever I want to login to my PC:
Keys: Press S to skip mounting or M for ...
2
votes
2answers
53 views
Different error messages when using different strings in terminal
When I insert, for example, unix.stackexchange.com followed by Enter in terminal, I get the following error:
unix.stackexchange.com: command not found
This is ok and as I expected. But when I insert ...
2
votes
4answers
469 views
How to catch an error in a linux bash script?
I made the following script:
# !/bin/bash
# OUTPUT-COLORING
red='\e[0;31m'
green='\e[0;32m'
NC='\e[0m' # No Color
# FUNCTIONS
# directoryExists - Does the directory exist?
function directoryExists ...
3
votes
2answers
89 views
Getting the complete command line that caused an ERR , while trap
How do I make trap to return the command that caused an ERR?
$function err_handler() { echo "$0 caused the error"; }
$ trap err_handler ERR
$ grep -ci "failed" test4 &>/dev/null
-bash caused ...
1
vote
1answer
88 views
Detecting SSH timeout
Is there any way I could trigger a bash script when ssh times out?
I have an alias to set the tmux title when starting ssh. The alias also includes a title change after the ssh session, which works ...
2
votes
3answers
135 views
Exception handling when using tail -f to monitor a log
I have a main script calling the script to do the monitoring.
I am trying to catch the exception that the log is missing or not accessible anymore.
tail -f is used instead of -F since the logs are ...
13
votes
4answers
2k views
How to make bash abort the execution of a script on syntax error?
To be on safe side, I'd like bash abort the execution of a script if it encounters a syntax error.
To my surprise, I can't achieve this. (set -e is not enough.) Example:
#!/bin/bash
# Do exit on ...
7
votes
4answers
279 views
Which data should be excluded from log files , error messages etc. if posted online?
What data should one erase from log files, error messages etc., if posting them as a screenshot so as not to expose sensitive information? As I have little knowledge about this topic, I can vividly ...
6
votes
1answer
361 views
rsync: skip files for which I don't have permissions
I'm using rsync -rlptD to copy a directory from another user. There are a few files (I have no way of knowing these in advance) which I don't have permission to copy. Is there a way have rsync ignore ...
3
votes
3answers
160 views
Mail cron output only when Git throws a real error
There exists a Git repo that is on one server, we want to generate doxygen output for it on a different server. The following command works for me but has the downside of sending a mail everytime the ...
2
votes
3answers
898 views
Suppress server message in rsync
When I rsync or scp from a particular server I get a rather long message telling me the rules of the server. However when I setup regular pulls, I'd like to be able to suppress those messages in my ...
3
votes
1answer
716 views
Capture screen content for error parsing
I am a database administrator working with DB2 on AIX. (Please continue to read as this is related more to ksh than DB2, otherwise I would have posted this over on dba.stackexchange.com.) I am ...
1
vote
2answers
4k views
how to view php and server error logs?
I am getting the WSOD now since editing settings.php; php.ini and .htaccess trying to update my site and I need to see error logs to find out what is happening.
Also how do you clear cache in command ...
2
votes
1answer
803 views
What does “DMA: Out of SW-IOMMU space” error mean?
First the link: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1060268
Since this affects the kernel and other Distros, what does this type of error mean and why it happens?
1
vote
0answers
273 views
error: implicit declaration of function ‘rt_dev_socket’
The developer says: http://comments.gmane.org/gmane.linux.real-time.rtnet.user/2546
Now how can I tell the Makefile to look for headers in
/usr/local/rtnet/include respectively ...
2
votes
1answer
1k views
Trap, ERR, and echoing the error line
I'm trying to create some error reporting using a Trap to call a function on all errors:
Trap "_func" ERR
Is it possible to get what line the ERR signal was sent from? The shell is bash.
If I do ...
1
vote
3answers
846 views
Does “226 Transfer complete” guarantee the consistency between local and remote files when using ftp?
I have some automated scripts which perform FTP uploads among other things. I'm wondering what level of error checking I should conduct once these uploads have finished executing.
Could anything go ...
1
vote
0answers
259 views
crossplatformui error in Mint 11
Whenever I try to install something in my system it generally installs but shows some error related to "crossplatformui". I don't know what it is and how to remove it.
I am printing here a sample ...
1
vote
1answer
2k views
Unprettyfied SSL error message?
I am trying to authenticate using my USB smartcard reader to a website.
I am running Ubuntu 10.04 LTS, with its most up to date Firefox browser 3.6.24.
I get the following error message:
Secure ...
4
votes
3answers
712 views
Crontab job not emailing on failure
I have a cron job on Debian:
1 * * * * /home/paradroid/bin/myscript.sh >/dev/null
There is an installed and configured MTA, and I have received emails when the script has a syntax error, so I ...
4
votes
2answers
901 views
Is it possible to get the error message from previous command which failed when the conditional command runs using ||
I have a helper function:
function error_exit
{
/opt/aws/bin/cfn-signal ...
exit 1
}
This helper function is used to signal an error. Here is an example of usage:
/opt/aws/bin/cfn-init -s ...
0
votes
1answer
387 views
How to fix “number of errors while writing to disk(or) multi-zone error rate”?
I ran hard disk checker, and i found this error:
Write Error Rate:
number of errors while writing to disk(or) multi-zone error rate
(or) flying-height
---
Normalized: 200
Worst: 200
Value: ...
4
votes
2answers
9k views
Can I fix bad blocks on my hard disk with a single command?
I'm working on fixing the errors in my Hard Disk, It's possible to do that manually but it might take hours.
After typing this command sudo badblocks -b 512 /dev/sda, I got hundreds of results and I ...
3
votes
2answers
5k views
What does this hard disk error message mean: “Current Pending Sector Count …”?
I grabbed this information from Disk Utillity on Linux Mint:
Current Pending Sector Count:
Normalized: 200
Worst: 200
Threshold: 0
Value: 22 sectors
What does it mean? Is it possible to ...
11
votes
3answers
2k views
How can I pipe output to another process, but retain the error state of the first process? [duplicate]
Possible Duplicate:
Get exit code of process that's piped to another
I am using the following command line (in a makefile) to pipe the verbose error messages from my compiler through a ...
2
votes
3answers
18k views
how to close X Server, to avoid errors while updating nvidia driver?
I tried to update my nvidia driver but i got an error when i ran the driver installation.
See the error:
ERROR: You appear to be running an X server; please exit X before
...
4
votes
0answers
159 views
Repeatably generate a read error for testing? [duplicate]
I'm trying to test the error handling in some software, in particular what happens when an error occurs reading from a file or pipe. Is there a simple way to send a certain amount of data to stdout ...
3
votes
2answers
317 views
How to use $? and test to check function?
#!/bin/sh
function checkExit(){
if test "$?" != "0"; then
echo Command $1 exited with abnormal status
exit 1;
else echo $?
fi
}
function echoThenRun () { # echo and then ...
9
votes
1answer
17k views
Where can I find a list of 'make' error codes?
I am trying to compile a program written in Fortran using make (I have a Makefile and, while in the directory containing the Makefile, I type the command $ make target, where "target" is a ...
2
votes
3answers
309 views
Are all system call error numbers unique?
I'm writing a program for Systems Programming in Unix, and one of the requirements is to process all possible error returns from system calls.
So, rather than having a function tailored to each ...
4
votes
3answers
1k views
Best practice to use $? in bash?
When I read this answer about $? another question comes to mind.
Is there any best practice for how to use $? in bash?
Let's have a example:
We have a linear script and I we would like to know ...
3
votes
4answers
2k views
Understand error codes in Linux
I am working on Linux (Kernel Version 2.6.32.28) laptop.
After I inserted/did file io/removed a SD combo card, I got following errors:
mmcblk0: error -123 sending status command
mmcblk0: error ...
5
votes
1answer
238 views
What is Linux for VMS DCL “ON ERROR”?
Using VMS DCL command scripts one can catch errors by using the on error command:
$ on error then goto MyErrorHandler
$ directory samiam.txt
$ delete x.txt
$ exit
$MyErrorHandler:
$ print ...