Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
waitforssh(1)		    General Commands Manual		 waitforssh(1)

NAME
       waitforssh -- Wait for a	target to be up	and running using SSH

SYNOPSIS
       waitforssh [-C command] [-T command] [-d	delay] [-r max-retries]	target
       waitforssh -v

DESCRIPTION
       waitforssh is a lightweight utility, written in POSIX shell, that waits
       for  a  target to be up and running via SSH and,	if so, executes	a com-
       mand.

       -v   Display version information	about waitforssh.

       -C command
	    Command to be executed when	waitforssh successfully	establishes  a
	    connection.

	    By	default,  this	parameter  is set to true which	means that the
	    true utility will be executed on target.

       -T command
	    Command to execute that controls the execution flow	of  waitforssh
	    and,  therefore, the exit status. When this	command	is the same as
	    the	one specified by the -C	parameter, only	this command  is  exe-
	    cuted. By default, true is the default test	command.

       -d delay
	    Before attempting to establish a connection	and execute a command,
	    waitforssh	waits for as many seconds as specified in this parame-
	    ter.

	    The	special	value random which is the default value,  is  accepted
	    to choose a	random number between 1	and 10.

	    See	for more details on the	syntax.

       -r max-retries
	    Total  number  of  retries before waitforssh exits with a non-zero
	    exit status.

ENVIRONMENT
       -   WAITFORSSH_LOGLEVEL:	Verbosity level	that is	used when logging mes-
	   sages from ssh(1).

	   QUIET is the	default	value.

       -   WAITFORSSH_STRICTHOSTKEYCHECKING: Controls how  ssh(1)  verifies  a
	   remote server's host	key to prevent man-in-the-middle attacks.

	   no is the default value.

       -   WAITFORSSH_USERKNOWNHOSTSFILE:  File	 storing  a list of public SSH
	   keys.

	   /dev/null is	the default value.

EXIT STATUS
       waitforssh may fail for one of the following reasons:

       -   EX_USAGE: The command was used incorrectly.
       -   EX_DATAERR: An argument is incorrect.
       -   EX_UNAVAILABLE A connection cannot be established.

SEE ALSO
       ssh(1) sshpass(1) sysexits(3) ssh_config(5)

AUTHORS
       Jess Daniel Colmenares Oviedo <DtxdF@disroot.org>

CAVEATS
       When waitforssh establishes a connection, it executes the true  utility
       as  the	first  command	to  check whether the remote system can	be ac-
       cessed.	If the -C parameter is set  to	true,  which  is  the  default
       value,  this operation is performed only	once, but if a different value
       is specified, the specified command is executed after running the  true
       utility.	 The  command  specified with the -C parameter does not	affect
       the exit	status in any way.

       All these operations use	the -T parameter of ssh(1), so	keep  in  mind
       that  some utilities may	not work correctly unless they are designed to
       be non-interactive utilities.

       Also note that this utility does	not prevent  keyboard-interactive  au-
       thentication  for  utilities such as sshpass(1) from working correctly.
       However,	it is better to	use public key authentication.

BUGS
       If the utility true is not found	on the remote system or	returns	a non-
       zero exit status, waitforssh retries as if it had failed	when  in  fact
       it succeeded.

SECURITY CONSIDERATIONS
       waitforssh was designed for ephemeral environments that can be accessed
       securely	(e.g.: via a VPN), which explains the default settings and pa-
       rameters	 chosen,  which	 may be	considered insecure. This utility does
       not replace utilities specialized in remote command execution, but only
       serves to wait for a remote device to be	operational and	nothing	 else.
       The fact	that an	arbitrary command can be executed with this utility is
       only a convenient feature in some cases.

FreeBSD	ports 15.quarterly     November	09, 2025		 waitforssh(1)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=waitforssh&sektion=1&manpath=FreeBSD+Ports+15.0.quarterly>

home | help