Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8220247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:27:32+00:00 2026-06-07T13:27:32+00:00

update: when I echo $res in the script below, I get the following, I

  • 0

update:
when I echo $res in the script below, I get the following, I guess it’s because the script itself contains the word searchd!! so at the very instant that the cronjob process gets executed, $res becomes empty!
I renamed the script, problem solved!

root 10769 7177 0 23:31 pts/1 00:00:00 /bin/bash /home/scripts/monitor_searchd.sh root 10770 10769 0 23:31 pts/1 00:00:00 /bin/bash /home/scripts/monitor_searchd.sh

original problem:

I have a shell script that works when I invoke it in the shell, but when putting in crontab in the following way, it doesn’t work(not sending an email). The strange thing is that cron log shows that the process is getting ran every minute!


    */1 * * * * root /home/scripts/monitor_searchd.sh

here’s the script:


    process="java"                                                                                                                                                                                 
    res="`ps -ef|grep $process|grep -v grep`"

    if [ ! -n "$res" ]; then
        echo "$process is down!" | mail -s "$process is down" xxx@gmail.com
    fi

cron log


    CROND[7370]: (root) CMD (/home/scripts/monitor_searchd.sh)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T13:27:35+00:00Added an answer on June 7, 2026 at 1:27 pm

    Can you please add:

    echo "$process is down!" >> /tmp/monitor_searcd.log
    

    before the line with mail? It could help localize the problem.

    And pair of small remarks:

    Please add

    #!/bin/bash
    

    to the first line of the script.

    Change

    [ ! -n "$res" ]
    

    to

    [ -z "$res" ]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the following code to update a div echo $this->Js->link($station[Company][name], array('action' =>
I am using this echo $this->Js->submit(Send, array( 'before'=>$this->Js->get('#sending')->effect('fadeIn'), 'success'=>$this->Js->get('#sending')->effect('fadeOut'), 'update'=>'#success' )); This is in
Here's my batch script: @echo off cls set SOURCE=svn://vcrep/UXP/ercpac/trunk/ set SVN=C:\Program Files\TortoiseSVN\bin %SVN%\TortoiseProc.exe /command:update
mysql_query(update users set balance=balance+'$pwbalance'-'$totalprice' where memberid='$memberid' and (balance+'$pwbalance'-'$totalprice')>=0)or die(mysql_error()); $count=mysql_affected_rows(); When I echo $pwbalance,
UPDATE 2: The following gives me UDPATE table SET db_field1=0, dbfield2=0, dbfield3=0, dbfield4=0 WHERE
Possible Duplicate: How are echo and print different in PHP? UPDATE : I found
I have the following script -- $(document).ready(function () { $(div.settings_frame_tabs_frame).(function () { $(div.settings_frame_tabs_heading ,this).click(function
I'm trying to get my callerid script to send a notification to my boxee
Many times i run time consuming PHP scripts that echo status updates like 'batch
This is pretty straight forward. EDIT: Updated question and added fourth echo. Here is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.