因此,我有一个脚本来寻找我的服务
vmxd.service
加载
,
跑步
忙碌的
...
systemctl --all --type service | awk -v pat="$SERVICE" '$0 ~ pat {print $0}'
â vmxd.service loaded failed failed Juniper vMX Router
$SERVICE="vmxd.service"
当我在另一台主机上检查脚本时,现在不再打印
vmxd。服务
因为它是字符串上的第一个字符,所以现在正在打印[],完全破坏了我的脚本。
Here is an Output of my Script showing the [â]
[...]
The service file: vmxd.service has been found under /etc/systemd/system/
Check if WorkingDirectory path is correct............................[OK]
Check if service exist...............................................[Found]
Check if â is loaded...............................................[No]
Check if â is active...............................................[No]
Enabling service....................................................../init.sh: line 189: command not found
Reloading Service....................................................[No]
Check if 'vmxd.service' has started successfully.....................[Started]
通常,我的脚本工作的服务器上的输出如下所示:
vmxd.service loaded active exited Juniper vMX Router
注意:我不太清楚这个点实际上意味着什么,但不管怎样,我只需要忽略运行命令的变量中的那个字符