%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 49.231.201.246 / Your IP : 216.73.216.248 Web Server : Apache/2.4.18 (Ubuntu) System : Linux 246 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : root ( 0) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/webmin/init/ |
Upload File : |
#!/usr/bin/perl # Create, update or delete a BSD RC script require './init-lib.pl'; &ReadParse(); $access{'bootup'} || &error($text{'edit_ecannot'}); &foreign_require("proc", "proc-lib.pl"); @rcs = &list_rc_scripts(); if (!$in{'new'}) { ($rc) = grep { $_->{'name'} eq $in{'name'} } @rcs; $rc || &error($text{'edit_egone'}); } if ($in{'delete'}) { # Delete the action script &delete_rc_script($in{'name'}); &webmin_log("delete", "action", $in{'name'}); &redirect(""); } elsif ($in{'start'} || $in{'stop'} || $in{'status'}) { # Run now $mode = $in{'start'} ? "start" : $in{'stop'} ? "stop" : "status"; &ui_print_header(undef, $text{'ss_'.$mode}, ""); print &text('ss_doing'.$mode, "<tt>$in{'name'}</tt>"),"<br>\n"; $cmd = "$rc->{'file'} $mode"; print "<pre>"; &foreign_call("proc", "safe_process_exec_logged", $cmd, 0, 0, STDOUT, undef, 1); print "</pre>\n"; &webmin_log($mode, 'action', $in{'name'}); &ui_print_footer("edit_rc.cgi?name=".&urlize($in{'name'}), $text{'edit_return'}); } else { # Validate inputs if ($in{'new'}) { $in{'name'} =~ /^[A-z0-9\_\-\.]+$/ || &error($text{'save_ename'}); ($clash) = grep { $_->{'name'} eq $in{'name'} } @rcs; $clash && &error($text{'save_eclash'}); $in{'start_cmd'} =~ /\S/ || &error($text{'save_estartcmd'}); @dirs = split(/\s+/, $config{'rc_dir'}); $file = $dirs[$#dir]."/".$in{'name'}; $data = "#!/bin/sh\n"; $data .= "#\n"; $data .= "# PROVIDE: $in{'name'}\n"; $data .= "# REQUIRE: LOGIN\n"; $data .= "\n"; $data .= ". /etc/rc.subr\n"; $data .= "\n"; $data .= "name=$in{'name'}\n"; $data .= "rcvar=`set_rcvar`\n"; $data .= "start_cmd=\"$in{'start_cmd'}\"\n"; if ($in{'stop_cmd'}) { $data .= "stop_cmd=\"$in{'stop_cmd'}\"\n"; } if ($in{'status_cmd'}) { $data .= "status_cmd=\"$in{'status_cmd'}\"\n"; } $data .= "\n"; $data .= "load_rc_config \${name}\n"; $data .= "run_rc_command \"\$1\"\n"; } else { $data = $in{'script'}; $data =~ s/\r//g; $data =~ /\S/ || &error($text{'save_escript'}); $file = $rc->{'file'}; } # Write out the file &open_lock_tempfile(SCRIPT, ">$file"); &print_tempfile(SCRIPT, $data); &close_tempfile(SCRIPT); &set_ownership_permissions(undef, undef, 0755, $file); if ($rc->{'enabled'} != 2) { # Enable or disable &lock_rc_files(); if ($in{'enabled'}) { &enable_rc_script($in{'name'}); } else { &disable_rc_script($in{'name'}); } &unlock_rc_files(); } &webmin_log($in{'new'} ? "create" : "modify", "action", $in{'name'}); &redirect(""); }