2
Contributors
5
Replies
7
Views
7 Years
Discussion Span
Last Post by rbross
1

Write a bash script to run that line of code. Something similar to this:

#!/bin/bash

PID_GREP=`ps aux | grep http://www.somedomain.com/myserver.php | grep -v grep`
PID_COUNT=`echo "$PID_GREP" | awk '/myserver.php/ { n++ }; END { print n+0 }'`
if [ ! $PID_COUNT ]
then
lynx -dump http://www.somedomain.com/myserver.php
fi

Rick Bross

Edited by Ezzaral: Snipped personal link. Please restrict such links to your site-wide user signature, which can be edited from the user control panel.

0

Thanks f
But it doesn't work
if i do ps aux i get alot of apache 4365 0.0 0.7 386096 45168 ? S JAN25 1:26 /usr/sbin/httpd but no referens to what website they serves

0

My fault, as I only search for part of your string. You can search for the entire command string.

If you respond, please cut and paste your script. Every tick mark, punctuation, and space is important in a shell script.

Also, another mistake is the line should be:

if [ $PID_COUNT == 0 ]

I didn't actually run the script. It was intended as a baseline for you.

Edited by rbross: n/a

0

Thank that helpt a lot

ure code was fare les buggy then my first test about it
sorry for that

think it works now

FYI

- wasn't that sure about lynx -dump option so now using curl
- didn't get awk to read $PID_GREP so had to put it all in one line
- awk don't like . (dot)

#!/bin/bash
PID_COUNT=`ps aux |grep curl |grep -v grep |awk '/layer/tweetserver { n++ }; END {print n+0}'`
if [ $PID_COUNT == 0 ]
then
curl http://www.openeindhoven.nl/layer/tweetsever.php
fi]
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.