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 8274049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:37:41+00:00 2026-06-08T07:37:41+00:00

I have some shell script as below, I want to run this process for

  • 0

I have some shell script as below,

I want to run this process for only 1 minute.

So I want to check the process time and kill the process if it runs > 1 minute. Can anyone help me please?

var=`ps -eaf | pgrep -f getShippingPriceUK.php | wc -l`
if [ $var -lt "1" ]; then
echo "Prozess läuft nicht"
wget -q --timeout=0 --delete-after http://xxxx/001_yakodo/getShippingPrice12.php > /dev/null 2&>1 &
else
echo "Prozess läuft"
fi
  • 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-08T07:37:43+00:00Added an answer on June 8, 2026 at 7:37 am

    If you have perl installed, you can use this perl script.

    Save it as timeout, store it in one of the directories in $PATH, make it executable, then replace all calls to

    your-script arg1...
    

    with

    timeout 1m your-script arg1...
    

    #!/usr/bin/perl
    
    use warnings;
    use strict;
    
    
    $SIG{CHLD} = sub { wait; exit };
    
    my $timeout = shift;
    for ($timeout) {
        if (defined and /^(\d+)([smh])$/) {
        $_ = $1 * ("s" eq $2 ? 1 : "m" eq $2 ? 60 : 3600);
        } elsif (!defined or /\D/) {
        die "First argument must be time to wait.\n";
        }
    }
    
    my @command = @ARGV or die "Must give a command to run.\n";
    
    my $child = fork;
    for ($child) {
        die "$0: Cannot fork: $!\n" unless defined;
        last if $child;
        exec {$command[0]} @command or die "$0: Cannot exec: $!\n";
    }
    
    close STDIN;
    close STDOUT;
    close STDERR;
    sleep $timeout;
    kill TERM => $child;
    sleep 5;
    kill KILL => $child;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Started to learn some shell scripting. I have a perl script that runs on
I have some very big delimited data files and I want to process only
I have a shell script that greps some data.. I want to print the
I have some Perl code that executes a shell script for multiple parameters, to
I have a Unix shell script (bash) that sources some environment variables and then
I have written a simple shell script to do some automation work. Basically the
I have written a shell script which executing some of the mysql commands. I
I have a bash shell script which calls some python scripts. I am running
I have a shell script script here as below: #!/bin/bash CPUSELECTION=1 386SX off \
I have noticed some weird behavior when sourcing another script within my shell script.

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.