Re: [gentoo-user] crontab entry
Quoting Kaushal Shriyan <[EMAIL PROTECTED]>: so according to your suggestion where does this line fits "cat /tmp/file|mailx -s "my subject" [EMAIL PROTECTED]" <[EMAIL PROTECTED]> in my above bash script Dirk gave a lovely one-liner, but my guess is you'll get sick of having to actually check the body of the e-mail to know whether there is a problem, so you could also put the system call to mailx in the if-then-else-fi and indicate in the subject line whether it is a success or failure. Also, you want to cut out the echo or else cron will send an e-mail (remember cron sends an e-mail if there's any output from the command), which is redundant now that you're calling mailx. Finally, note that you left a '>' out of your rsync call. It's fixed below. #!/bin/bash #rsync mysql database shell script #author kaushal #created on 21/03/2008 TIMESTAMP=`date +%Y-%m-%d-%H:%M:%S:%N` if rsync -av /var/lib/mysql [EMAIL PROTECTED]:/var/lib/ \ > /tmp/rsync-${TIMESTAMP}.log 2>&1 then cat /tmp/rsync-${TIMESTAMP}.log | \ mailx -s "Success: hostxx:yyDB refresh daily" <[EMAIL PROTECTED]> else cat /tmp/rsync-${TIMESTAMP}.log | \ mailx -s "Error: hostxx:yyDB refresh daily" <[EMAIL PROTECTED]> fi Hope this helps, Cheers, -Collin -- Collin Starkweather, Ph.D. http://www.linkedin.com/in/collinstarkweather -- gentoo-user@lists.gentoo.org mailing list
Re: [gentoo-user] rsync script
Quoting Kaushal Shriyan <[EMAIL PROTECTED]>: Correct me if i am wrong please. I want to understand your script step 1 : put the above code in text file and name it as rsync-host77.sh in the folder /home/kaushal in the machine where rsync command will execute step 2 : cd /home/kaushal $crontab -e 0 18 * * * rsync -host77.sh If i want to run the rsync script at 6 pm everyday Also where will the "rsync-${TIMESTAMP}.log" file will be located, I believe it will be in /home/kaushal folder. Lets say if i have to put "rsync-${TIMESTAMP}.log" in /tmp folder then the above rsync line would look like rsync -av /bogus [EMAIL PROTECTED]:/bogus/ &>/tmp/rsync-${TIMESTAMP}.log is that correct what i understand from your email You are correct, sir! You must also, of course, be sure to chmod u+x rsync-host77.sh. Note that if you want an e-mail on either success or failure (your original post seemed to indicate this might be the case) bash understands "if-then-else-fi". Cheers, -Collin -- Collin Starkweather, Ph.D. http://www.linkedin.com/in/collinstarkweather -- gentoo-user@lists.gentoo.org mailing list
Re: [gentoo-user] rsync script
Quoting Kaushal Shriyan <[EMAIL PROTECTED]>: On Fri, Mar 21, 2008 at 12:56 PM, Alan McKinnon <[EMAIL PROTECTED]> wrote: On Friday 21 March 2008, Kaushal Shriyan wrote: > Hi > > [EMAIL PROTECTED] > 0 18 * * * rsync -av /var/lib/mysql [EMAIL PROTECTED]:/var/lib/ Run rsync through a script that tests the exit value, then prints an error message if the exit value is not equal to 0 and nothing otherwise. Run the script from cron and it will send you an e-mail if there is a problem. In bash, $? is the exit value of the last command. This is a bit verbose, but you could put the following in rsync-host77.sh: #!/bin/bash TIMESTAMP=`date +%Y-%m-%d-%H:%M:%S:%N` rsync -av /bogus [EMAIL PROTECTED]:/bogus/ &>rsync-${TIMESTAMP}.log EXITVALUE=$? if [[ "${EXITVALUE}" -ne "0" ]] then echo "Error: rsync exited with status ${EXITVALUE}" echo " " echo "Please check the file rsync-${TIMESTAMP}.log for errors." fi To find exit values and their corresponding meanings, search for "EXIT VALUES" in http://www.linuxmanpages.com/man1/rsync.1.php Hope this helps, -Collin -- Collin Starkweather, Ph.D. http://www.linkedin.com/in/collinstarkweather -- gentoo-user@lists.gentoo.org mailing list
Re: [gentoo-user] Bizarre SSH connection reset
fire-eyes wrote: I don't have the pcap file yet ;) Not much I can do. Pardon the delay in reply. I've been getting behind on my reading. The capture has been forwarded. Cheers, -Collin -- gentoo-user@lists.gentoo.org mailing list
Re: [gentoo-user] Bizarre SSH connection reset
Quoting Dan Farrell <[EMAIL PROTECTED]>: On Sun, 9 Mar 2008 20:16:09 -0400 "Mark Shields" <[EMAIL PROTECTED]> wrote: Are you thinking his ISP is doing port-based connection filtering? What kind of connection filtering allows a connection to go through for 5 seconds, then resets it? I've been wondering the same thing. Typically, one wouldn't even expect to get through in the first place if there were filtering. The Great Firewall of China works by immediately sending hangup packets to both sides, spoofing they're coming from the appropriate party. But typically that happens the instant you try to establish a connection. Moreover, because I can get in from the local hotspot, I wouldn't imagine it's a Great Firewall issue. Some ISPs and the university campus (I believe I'm going through the local university's ISP) do their own filtering, but I can't imagine why a "5-second rule" would be implemented. -Collin -- gentoo-user@lists.gentoo.org mailing list
Re: [gentoo-user] Bizarre SSH connection reset
Quoting Mick <[EMAIL PROTECTED]>: I would argue that your Chinese domain is blacklisted due to exhaustive number of owned MSWindows boxen and botnets that ping the rest of us without respite, from China. I really wish their step 1 was "learn how to protect your PC, even if it runs an illegitimate Mickey Mouse OS". You're not whistlin' Dixie ... every USB stick I've ever been handed in China has a virus on it. Are you using the same NIC on the laptop? If yes, then the issue could be related to your router configuration., but my money is on your keepalive settings. See if my suggestions above help. Thanks. I'll give it a shot. -Collin -- gentoo-user@lists.gentoo.org mailing list
Re: [gentoo-user] Fwd: apache vhost issue...
Quoting Strong Cypher <[EMAIL PROTECTED]>: yeah of course but apache need to now all ip of all host before starting. try to add it and restart apache 2008/3/9, Elyahou ITTAH <[EMAIL PROTECTED]>: 2008/3/9, Strong Cypher <[EMAIL PROTECTED]>: > hi, > did you add your host in the hosts file? Nope, but I am tryingto connect not from that machine but from another one... Also, what do you get when you tail -n 100 /.../logs/access_log | grep helpermaster.fr -Collin -- gentoo-user@lists.gentoo.org mailing list
Re: [gentoo-user] Fwd: apache vhost issue...
Quoting Strong Cypher <[EMAIL PROTECTED]>: yeah of course but apache need to now all ip of all host before starting. try to add it and restart apache 2008/3/9, Elyahou ITTAH <[EMAIL PROTECTED]>: 2008/3/9, Strong Cypher <[EMAIL PROTECTED]>: > hi, > did you add your host in the hosts file? Nope, but I am tryingto connect not from that machine but from another one... In response to an earlier comment about a redundant ServerName / ServerAlias, typically those would look something like ServerName www.bogusdomain.com ServerAlias bogusdomain.com *.bogusdomain.com -Collin -- gentoo-user@lists.gentoo.org mailing list
[gentoo-user] Bizarre SSH connection reset
To preface the question, I should mention that I'm currently residing in China, so communication with the networking guys on this end is a bit difficult because the communication algorithm typically begins, "Step 1: Learn Chinese." I am having difficulties with getting bumped out of an SSH connection from a server in the U.S. with "Connection reset by peer" maybe 5-10 seconds after logging in. It *only* occurs in my apartment; i.e., when I go to a local wifi hotspot, I have no difficulties whatsoever. So I don't think it's coming from my end, and I don't think it's coming from the server I'm logging in to. Some details: 1) To ensure that I'm not having problems with keepalives, I configured SSHD on the other end very liberally (with some impressively fast typing, if I do say so myself). In sshd_config, I have TCPKeepAlive no ClientAliveInterval 15 ClientAliveCountMax 12 2) I then set ethereal running. Just as I got bumped, it indicated SourceDestination Protocol Info (the server) (my laptop) TCP 22 > 1259 [RST, ACK] Seq=5357 Ack=4037 Win=63856 Len=0 I'm not a networking guy, but I think that means a reset packet is being sent, ostensibly from the server. 3) When I get bumped, ssh -vvv gives the following debug1: channel 0: free: client-session, nchannels 1 debug3: channel 0: status: The following connections are open: #0 client-session (t4 r0 i0/0 o0/0 fd 4/5 cfd -1) debug3: channel 0: close_fds r 4 w 5 e 6 c -1 Read from remote host www.bogusdomain.com: Connection reset by peer Connection to www.bogusdomain.com closed. debug1: Transferred: stdin 0, stdout 0, stderr 126 bytes in 17.1 seconds debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 7.4 debug1: Exit status -1 If the reset is not coming from the server or the client (I don't have any problems when I'm at a hotspot), where could it be coming from? Thanks in advance, -Collin -- Collin Starkweather, Ph.D. http://www.linkedin.com/in/collinstarkweather -- gentoo-user@lists.gentoo.org mailing list