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; } }