misconfiguration has asked for the wisdom of the Perl Monks concerning the following question:
if ($add) { $add = lc($add); if ( -e "/var/spool/lp/request/$add" ) { die "This printer is already defined!\n"; } else { my %add_cmd = ( add => "addqueue -h $add -q $add -i 3" ); # Lab Version will be more sophisticated print "Adding queue \"$add\"\n"; system( $add_cmd {'add'} ); sleep 5; # If spooler is down, automatically restart it. print "Checking the status of the print spooler....\n"; my $spooler = `lpstat -r`; if ( $spooler = "scheduler is not running" ) { system("lpsched"); } sleep 5; print ".... Done \n"; exit 0; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Backticks and Pattern Matching.
by halley (Prior) on Feb 05, 2008 at 15:30 UTC | |
|
Re: Backticks and Pattern Matching.
by rgiskard (Hermit) on Feb 05, 2008 at 15:35 UTC | |
|
Re: Backticks and Pattern Matching.
by apl (Monsignor) on Feb 05, 2008 at 16:06 UTC | |
by misconfiguration (Sexton) on Feb 05, 2008 at 16:08 UTC |