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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:40:13+00:00 2026-06-05T05:40:13+00:00

I use php to execute scp commands via ssh via a wrapper function. The

  • 0

I use php to execute scp commands via ssh via a wrapper function. The moves are between local and remote servers.

I roughly know how long the script should execute for, and I would like to kill the scp process if its taking too long (due to a destination server getting bogged down, or other network issues). When this happens currently, the scp processes get locked up completely until the destination server is restarted or the scp processes are killed manually from command line.

Can I pass some kind of timeout into shell_exec() that will quit the work its doing and proceed with the script execution?

  • 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-05T05:40:14+00:00Added an answer on June 5, 2026 at 5:40 am

    Wrap your command with the UNIX timeout utility.

    system('timeout n ../my/aa');
                    ^
    

    Where n is some integer value in seconds.

    If the command times out, then exit with status 124. Otherwise, exit
    with the status of COMMAND. If no signal is specified, send the TERM
    signal upon timeout. The TERM signal kills any process that does not
    block or catch that signal. For other processes, it may be necessary
    to use the KILL (9) signal, since this signal cannot be caught.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the option to execute a program directly via CGI or use PHP
Should I use php PDO or normal mysql_connect to execute database queries in PHP?
I use PHP mail() function to send emails from my website. No problems with
I want to execute this command php app/console doctrine:schema:update from the controles without use
I would like to execute a single PHP statement like if(function_exists("my_func")) echo 'function exists';
I want to execute a php-script from php that will use different constants and
If I use PHP's popen command to execute a script, does is execute it
Can I use PHP exec() to run a terminal command on a remote server?
Is there anything I can use to have PHP execute in a self contained
Use PHP and Mysql. Fields in my table (product) are id , full_price ,

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.