我正在维护一个Upstart脚本(版本0.6.5),在pre-start script ,如果不满足前提条件,则会有一个testing来终止该服务: pre-start script if [ ! -f $REQUIRED_FILE ]; then echo "$REQUIRED_FILE does not exit" >> $LOG_FILE stop exit 1 fi end script 根据csh / tcsh参考文档, stop [jobIDs] : 挂起当前后台作业或由jobID指定的后台作业; 这是Ctrl-Z或暂停的补充。 我看不出有什么用途可以stop来,特别是在服务尚未开始的pre-start部分(即由exec节)。 我在这里错过了什么? 或者是stop在这里多余的和不必要的?
我开始学习bash脚本,需要编写脚本在NGINX上安装fastcgi_cache 。 我需要使用fastcgi_cache设置replacePHP的默认位置。 要清楚,我需要取代这个: location ~ \.php$ { fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } 有了这个: location ~ .php$ { fastcgi_pass unix:/var/run/php5-fpm.sock ; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; access_log /var/log/nginx/$SITE_URL.cache.log cache; fastcgi_cache_key "$mobile$scheme$request_method$host$request_uri"; fastcgi_cache_bypass $skip_cache; fastcgi_no_cache $skip_cache; fastcgi_cache WORDPRESS; add_header X-Cache-Status $upstream_cache_status ; } 我相信这可以用sed来完成,但我找不到办法。 我设法通过一种解决方法来工作,如下所示: if [ -f "/etc/nginx/sites-enabled/$SITE_URL" ] then sed -i.bak […]
说我有这个文件夹结构里面的这些文件: ./ |—- orig/ |— 1a |— 1b |— 2a |— 2b |—- 1/ <empty> |—- 2/ <empty> 我想用一个mv命令得到这个: ./ |—- orig/ <empty> |—- 1/ |— 1a |— 1b |—- 2/ |— 2a |— 2b 我在想这样的事情,但是如果有某种“可变通配符”的话,我就找不到任何地方: $ mv orig/<var>* <var>/ 这是可能的zsh,bash或类似的?
我已经search和搜查,但没有find我正在寻找的运气。 我想要一个脚本,将计算机的名称和本地,而不是联网的计算机写入一个csv文件。 例: 计算机名称printer1 printer2 从我的研究中,下面的命令为我提供了一些我所需要的打印机信息: Get-Printer | select名称,types 我想追加输出到一个CSV文件,而不是覆盖它。 有什么build议么? 谢谢
我正在尝试在我的VPS中进行自定义服务。 但是,它不让我去运行它。 它说以下。 我不知道发生了什么事,但是当我在Ubuntu笔记本电脑上运行它时,它正常工作。 可能是什么问题呢? sudo systemctl启动websocket.service Failed to issue method call: Unit websocket.service failed to load: No such file or directory. See system logs and 'systemctl status websocket.service' for details. cat /lib/systemd/system/websocket.service [Unit] Description=php webSocket After=syslog.target network.target [Service] User=root Type=simple ExecStart=/usr/bin/webs.sh TimeoutStopSec=20 KillMode=process Restart=always RestartSec=2 [Install] WantedBy=multi-user.target Alias=websocket.service cat /usr/bin/webs.sh #!/bin/bash ### BEGIN INIT […]
我需要使用shell脚本在IBM WebSphere Application Server 8.5.5中dynamic获取Deployment Manager主机名和端口。
我已经接受了一个艰巨的任务,就是将其中一台“原始”机器的软件包部署到其他机器上 – 总共大约有120台机器。 所有的机器都运行CentOS 6.8。 高级用户已经在原始机器上进行了function检查,并认为它值得所有的testing/模拟运行等。 你可能会认为这会像在原始机器上安装yum list> pristinemachine_pkgs.txt一样简单,然后在其他机器上安装yum install $(cat pristinemachine_pkgs.txt) 。 然而,在产生“包不可用”的yum结果中有足够的差异。 什么是工作是这样的: rpm -qa –qf="%{NAME}.%{ARCH}\n" | sort > pristinemachine_pkgs.txt 然后,在testing机器上: yum install $(cat pristinemachine_pkgs.txt) 但是,在这样做之后,我从原始机器和testing机器中find了一些问题。 显然,我的前任暂时启用了EPEL回购协议,安装了软件包,取消了回购协议,并安装了一次性的RPM。 谢天谢地,这个清单并不是那么庞大。 对于那些想知道我是怎么想到的,我在两台机器上运行了前一个RPM清单命令,并且运行了sdiff: http://pastebin.com/pFempAZN 然后从右列复制/粘贴项目到一个新的文件,现在正试图想出一些同时阅读行yum info extrarpms.txttypes的交易分析原始回购。 我有两个问题grep'ing: for i in $(cat extrarpms.txt); do yum info $i | grep Name && grep From; done 这里是extrarpms.txt的pastebin以供参考: http ://pastebin.com/VvPgU3vN […]
我正在尝试运行Powershell脚本,该脚本将清理至less110天内未与Exchange 2013服务器同步的任何电话。 我的代码将拉取数据并将其导出到CSV,但是当我尝试使用Remove-MobileDevice命令删除设备时,脚本无法执行此操作。 到目前为止,我在互联网上find的东西都没有什么帮助。 大多数使用过时的ActiveSyncDevice cmdlet。 这里是我的代码,我是PowerShell的新手,感谢任何帮助: Get-MobileDevice -result unlimited | Get-MobileDeviceStatistics | where {$_.LastSuccessSync -le (Get-Date).AddDays(“-110”)} | select devicetype, deviceidentity, deviceos, deviceuseragent, identity | Export-csv C:\PhoneSync\Logs\Stale_Devices_110days_$((Get-Date).ToString('MM-dd-yyyy_hh-mm-ss')).csv | foreach (Remove-MobileDevice -Identity DeviceUserAgent -confirm:$false)
运行该命令并获取下面的错误MGS,你能帮我怎么跳过错误和更进一步,并创build单独的文件与故障的服务器 @Get@() Get-HotFix -ComputerName $Ser -Id kbXXXXX -ErrorAction SilentlyContinue -ErrorVariable err | select HotfixID, Description, InstalledOn, CSName| Sort-Object InstalledOn | ConvertTo-Csv -NoTypeInformation | Out-File "xxx.csv" *Error Mgs* Get-HotFix : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA) At line:1 char:1 + Get-HotFix -ComputerName $Ser -Id kbXXXXXX -ErrorAction SilentlyContinue -Error … + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo […]
我试图设置一个非pipe理员能够通过PowerShell远程将事件写入应用程序日志。 远程处理工作,我可以读取registry等。只是不写入事件日志。 invoke-command -ComputerName myhost { write-eventlog -LogName Application -Source CMS -EntryType Information -EventID 200 -Message "Testing CMS event" } 错误是 The registry key for the log "Application" for source "CMS" could not be opened. + CategoryInfo : PermissionDenied: (:) [Write-EventLog], Exception + FullyQualifiedErrorId : The registry key for the log "Application" for source "CMS" […]