scripting

PBS programming

醉酒当歌 提交于 2020-01-05 14:06:29
问题 some short and probably stupid questions about PBS: 1- I submit jobs using qsub job_file is it possible to submit a (sub)job inside a job file? 2- I have the following script: qsub job_a qsub job_b For launching job_b, it would be great to have before the results of job_a finished. Is it possible to put some kind of barrier or some otehr workaround so job_b is not launched until job_a finished? Thanks 回答1: Answer to the first question: Typically you're only allowed to submit jobs from the

Replace string without regex

不想你离开。 提交于 2020-01-05 08:43:37
问题 I would like to have a shell script to do a find and replace on anything without using regular expressions (regex), that includes all the specials chars such as !@#$%¨&*()?^~]}[{´`>.<,"' So for example the function would be able to receive two parameters where the 1st will be what I want to find, and the second parameter will be what will be replaced with. Example 1: File1: BETWEEN TO_DATE('&1','YYYY-MM-DD') +1 and TO_DATE('&2','YYYY-MM-DD') +15 First parameter: TO_DATE('&1','YYYY-MM-DD')

How to load rvm with correct gemset then execute a rake task

寵の児 提交于 2020-01-05 06:32:11
问题 Writing a script that cds into another dir, loads the correct rvm rvmrc file, then allows me to execute a rake task. I have the below script working on my computer, but when others pull it down to their machine they get the following error "Ruby rvmrc is not installed". Bundler.with_clean_env do Dir.chdir("../some_dir") do puts `source ~/.rvm/scripts/rvm && rvm --with-rubies rvmrc exec -- rake some_task` end end I have the most up to date version of rvm (so do they) and I'm on mt.lion I have

How to capture and display output from a task via Windows CMD

安稳与你 提交于 2020-01-05 05:44:05
问题 I've got a PHP script which I'm running from a command line (windows) that performs a variety of tasks, and the only output it gives is via 'print' statements which output direct to screen. What I want to do is capture this to a log file as well. I know I can do: php-cli script.php > log.txt But the problem with this approach is that all the output is written to the log file, but I can't see how things are running in the mean time (so I can stop the process if anything dodgy is happening).

Using WMI to get printer logs

夙愿已清 提交于 2020-01-05 05:34:11
问题 I'm trying to use WMI to get printer system logs from several servers. A week ago I made the following code which for some reason only works sometimes: wmic /node:<servername> NTEvent WHERE "logfile='System' AND SourceName='Print' AND TimeGenerated > '20130219'" get EventCode,TimeGenerated,Message This line of code sometimes will work, but the majority of the time I'm getting the following error whenever I've tried running it to get logs: ERROR: Code = 0x80020009 Description = Exception

groovy script to delete artifacts on nexus 3 (not nexus 2)

无人久伴 提交于 2020-01-05 03:32:15
问题 i have nexus 3 server that i save artifacts on it, and it has been filled to max. i wish to create a task to delete the old artifacts every day but always remain with at least 50 artifacts. the problem is that the default task that should do it, does't work. so i read that it can be done with a groovy script that i schedule to run inside tasks. can anyone help me with it? i can't find anything useful on the internet. 回答1: based on @daniel-schröter answer you could add a Scheduled Task

Bitbucket Webhooks

眉间皱痕 提交于 2020-01-04 18:15:31
问题 I want to automate the deployment of one of my projects onto my server. I m using git via bitbucket to version control my software. I came accross this this nice tutorial. Unfortunately i cannot get it to work. If i push changes from my local working copy, the remote repo gets updated but the webhook gives me the 404 error. So communication with my server was established but the script was not found. When i manually start the script via php bitbucket-hook.php a pull request is issued on the

Command not found Error (stderr) while comparing string in Bash Script [duplicate]

自作多情 提交于 2020-01-04 16:58:23
问题 This question already has answers here : bash, command not found [duplicate] (2 answers) Closed 5 years ago . Problem is to read one character from the user (this may be 'Y', 'y', 'N', 'n' ). If the character is Y or y display YES . If the character is N or n display NO . Original Problem Here's my code: read option if ["$option"=="y"] || ["$option"=="Y"] then echo "YES" else echo "NO" fi It throws an Error (stderr) solution.sh: line 2: [Y=y]: command not found solution.sh: line 2: [Y=Y]:

How to do error handling in nant build scripts?

♀尐吖头ヾ 提交于 2020-01-04 13:34:26
问题 I am writing a NAnt build script which is responsible for deploying some files to an iss server. As part of this I would like to add error handling to my scripts - something which I haven't used before. Introducing error handling inevitably leads to thoughts about the structure of the build file (s). I think of structure as the grouping of logic in targets and the dependencies between these. In NAntContrib I have found the task which should make the job easier than the standard "onfailure"

Checking Time and executing different instrcutions based on hour

痴心易碎 提交于 2020-01-04 12:47:13
问题 I am using a Robocopy command on a Windows Server 2003 server to copy a series of EDB files to special folders from user workstations onto a server. I want to run the robocopy commands twice, once in the mid-morning and once in the afternoon. The way I KNOW how to do this would be to write two independent batch files that are scheduled to run at different times. Each batch would copy the EDBs to different directories. But it occurred to me I should be able to do this in one batch file by: