我有一个简单的期望脚本名称“vpnloginpractice.sh”来启动我的 VPN。该脚本位于“/etc/openvpn/”中,如果我手动运行它可以正常工作。我尝试使用 systemd 在启动时执行脚本,但它不会启动 VPN。下面是我的 VPN 脚本的代码和我在目录 /etc/systemd/system 中创建的服务。我做错了什么伙计们?
#------/etc/systemd/system/personal.service permissions "-rwxrwxrwx" ---
[Unit]
Description=startVpnService
[Service]
ExecStart=/etc/openvpn/vpnloginpractice.sh
[Install]
WantedBy=multi-user.target
#------Code of my VPN script with permissions "-rwxrwxrwx"----
#!/usr/bin/expect
set timeout -1
set vpnuser "111111"
set vpnpassword "1234"
set rootpassword "12345"
spawn sudo openvpn {US California.ovpn}
expect "*password*:"
send "$rootpassword\r"
expect "Enter Auth Username: "
send "$vpnuser\r"
expect "Enter Auth Password:"
sleep 5
send "$vpnpassword\r"
send -- "\r"
expect eof