Escape new line in jil file - autosys

How could I escape new line in autosys jil file?
delete_job: <job name>
insert_job: <job name> job_type: c
command: <sh file>
machine: <host>
owner: <owner>
permission: gx,mx
condition: s(A, 06.00)
& s(B, 06.00)
std_out_file: <job name>.out
std_err_file: <job name>.err
alarm_if_fail: 0
Previous gives me error:
CAUAJM_E_50254 Unexpected line for <job name>: &

Related

Autosys - Get Jobs list on a specific computer

I try to get the list of all the jobs running on a specific client.
When running autorep -J ALL -q I get the following output:
/* ----------------- ### ----------------- */
insert_job: ### job_type: CMD
box_name: ###
command: ###
machine: MACHINE X
owner: autosys
permission:
date_conditions: ###
condition: ###
description: ###
box_terminator: 1
alarm_if_fail: 0
application: ###
/* ----------------- ### ----------------- */
insert_job: ### job_type: CMD
box_name: ###
command: ###
machine: MACHINE Y
owner: autosys
permission:
date_conditions: ###
condition: ###
description: ###
box_terminator: 1
alarm_if_fail: 0
application: ###
...
As you can see, is displayed here the list of ALL the jobs for ALL the clients
What I expect to get is an output as following :
/* ----------------- ### ----------------- */
insert_job: ### job_type: CMD
box_name: ###
command: ###
machine: MACHINE X
owner: autosys
permission:
date_conditions: ###
condition: ###
description: ###
box_terminator: 1
alarm_if_fail: 0
application: ###
/* ----------------- ### ----------------- */
insert_job: ### job_type: CMD
box_name: ###
command: ###
machine: MACHINE X
owner: autosys
permission:
date_conditions: ###
condition: ###
description: ###
box_terminator: 1
alarm_if_fail: 0
application: ###
...
Unfortunately the commands autorep -J ALL -q -m MACHINE X doesn't work but give me the following output :
/* ----------------- MACHINE X ----------------- */
insert_machine: MACHINE X
type: a
factor: 1.00
port: 7520
node_name: MACHINE X
agent_name: WA_AGENT
encryption_type: DEFAULT
opsys: windows
character_code: ASCII
I guess that this is the JIL format to add a machine, so what no I expect to get.
Do you know if what I try to do is possible using autosys commands only or if I have to parse the first output trough some regex to finally obtain what I would like to ?
I have created a Autosys Jill parser , using that you can have required info in csv file .After that you can filter required information
first you must have a file which contains required columns to be extracted from jill like
$]cat Jill_Columns
insert_job
job_type
box_name
watch_file
watch_interval
command
date_conditions
machine
owner
permission
condition
days_of_week
exclude_calendar
start_times
description
std_out_file
std_err_file
alarm_if_fail
profile
application
and Jill file which needs to be parsed to csv
Here is the script
Command to run in unix box
sh JillToCsv.sh Your_Jill_Columns Yours_Jill_file
#!/bin/bash
Usage()
{
echo "----------------------------------------------------------------------------"
echo " "
echo " "
echo " "
echo "This script takes two parameter "
echo "First is the file which conatins column names like below for Jill information "
echo "cat Jill_ColumnOrder.txt"
echo "insert_job
job_type
box_name
command
date_conditions
machine
owner
permission
condition
days_of_week
exclude_calendar
start_times
description
std_out_file
std_err_file
alarm_if_fail
profile
application"
echo " "
echo " "
echo " "
echo "Second is the Jill File which needs to be parsed as csv "
echo " "
echo " "
echo " "
echo "----------------------------------------------------------------------------"
}
if [ $# -eq 2 ]
then
echo "File which contains column names : $1"
echo "Input Jill File : $2"
else
echo "Please pass manadatory parameters"
Usage
exit 1
fi
Jill_ColumnOrder=$1
tfile=$2
dos2unix $tfile
final=${tfile}_Parse.csv
rm -f $final
heading=`cat $Jill_ColumnOrder|sed 's/$/#Akhilesh#/g'|sed '$ s/#Akhilesh#$//g'|tr -d '\n'`
line=
filler=1
no_columns=`cat $Jill_ColumnOrder|wc -l`
while [ $filler -lt $no_columns ]
do
filler=`expr $filler + 1`
line=$line`echo -n "#Akhilesh#"`
#echo $line
done
#echo "$heading"
#echo " "
#echo "$line"
echo "$heading">$final
count=1
cat $tfile|sed -r 's/job_type/\njob_type/g'|sed '/^$/d'|sed -r 's/\s+/ /g'|while read kk
do
echo "$kk"|sed -r 's/^[ ]+//g'|grep '\/\* -----------------' # >/dev/null
if [ $? -eq 0 ]
then
count=`expr $count + 1`
echo "$line">>$final
else
PP=`echo $kk|cut -d ':' -f1|tr -d ' '`
#echo "PP : $PP"
val=`echo $kk|cut -d ':' -f2-|sed -r 's/^[ ]+//g'|tr -d '"'|tr -d '\n'`
#echo $val
val=\"$val\"
field=`grep -nw $PP $Jill_ColumnOrder|cut -d':' -f1|tr -d '\n'`
#echo "field : $field"
if [ -z $field ]
then
echo "$PP not there in column list"
else
awk -F'#Akhilesh#' -v OFS=#Akhilesh# -v var="$val" -v var1=$count '{if(NR== var1) $'$field' = var;print}' $final > tmp.parse && mv tmp.parse $final
fi
fi
done
cat $final|sed 's/#Akhilesh#/,/g' > tmp.parse && mv tmp.parse $final
autorep does not support that sorting as of yet. You will need to parse out the output.
Dave
I have finally created a script that does it for me :
#!/bin/ksh
autorep -j ALL -q > alljobs.jil
mkdir /tmp/autosystemp
i=0
while IFS=\| read -r "line"; do
if [ `echo $line | grep '/* ------' | wc -l` -eq 1 ]; then
i=$((i+1))
fi
echo "$line" >> "/tmp/autosystemp/f$i"
done < alljobs.jil
rm tempo/f0
for file in /tmp/autosystemp/*; do
while read line; do
if [ `echo $line | grep "machine: $1" | wc -l` -eq 1 ]; then
cat $file >> "jobs-on-$1.jil"
fi
done < $file
done
rm -rf /tmp/autosystemp
To use it just pass the machine name as an argument to the script

About theme (hugo-academic) in blogdown

I am trying to install hugo-academic theme in blogdown. Within my site directory I ran R and installed with
blogdown::install_theme("gcushen/hugo-academic")
After installing I edited the config.toml file as shown below:
baseurl = "/"
relativeurls = true
languageCode = "en-us"
title = "A Hugo website"
theme = "hugo-academic"
googleAnalytics = ""
disqusShortname = ""
ignoreFiles = ["\\.Rmd$", "_files$", "_cache$"]
After that when I try to serve site with
blogdown::serve_site(),
I get the following error:
Started building sites ...
ERROR 2017/06/01 20:02:50 Error while rendering "page": template: theme/_default/single.html:10:7: executing "theme/_default/single.html" at <partial "article_met...>: error calling partial: template: theme/partials/article_metadata.html:7:24: executing "theme/partials/article_metadata.html" at <$.Site.Params.date_f...>: invalid value; expected string
Started building sites ...
ERROR 2017/06/01 20:02:50 Error while rendering "page": template: theme/_default/single.html:10:7: executing "theme/_default/single.html" at <partial "article_met...>: error calling partial: template: theme/partials/article_metadata.html:7:24: executing "theme/partials/article_metadata.html" at <$.Site.Params.date_f...>: invalid value; expected string
The system cannot find the path specified.
Error in shell(cmd, mustWork = TRUE, intern = intern) :
'"C:\Users\Suman\AppData\Roaming\Hugo\hugo.exe" -b / -D -F -d "public" -t hugo-academic' execution failed with error code 1
In addition: Warning messages:
1: running command '"C:\Users\Suman\AppData\Roaming\Hugo\hugo.exe" -b / -D -F -d "public" -t hugo-academic' had status 65535
2: running command '"C:\Users\Suman\AppData\Roaming\Hugo\hugo.exe" -b / -D -F -d "public" -t hugo-academic' had status 65535
3: running command 'C:\WINDOWS\system32\cmd.exe /c "C:\Users\Suman\AppData\Roaming\Hugo\hugo.exe" -b / -D -F -d "public" -t hugo-academic' had status 1
Any help to solve this?
Note: I am on Windows 10 64 bit OS.
Judging from the error message, you need to add a date_format parameter to your config.toml file. Try adding this at the end:
[params]
date_format = "Mon, Jan 2, 2006"
Take a look at the example config file for more settings that you can change.

Ansible Not copying directory using cp command

I have the following role:
---
- name: "Copying {{source_directory}} to {{destination_directory}}"
shell: cp -r "{{source_directory}}" "{{destination_directory}}"
being used as follows:
- { role: copy_folder, source_directory: "{{working_directory}}/ipsc/dist", destination_directory: "/opt/apache-tomcat-base/webapps/ips" }
with the parameters: working_directory: /opt/demoServer
This is being executed after I remove the directory using this role (as I do not want the previous contents)
- name: "Removing Folder {{path_to_file}}"
command: rm -r "{{path_to_file}}"
with parameters: path_to_file: "/opt/apache-tomcat-base/webapps/ips"
I get the following output:
TASK: [copy_folder | Copying /opt/demoServer/ipsc/dist to /opt/apache-tomcat-base/webapps/ips] ***
<md1cat01-demo.lnx.ix.com> ESTABLISH CONNECTION FOR USER: my.user
<md1cat01-demo.lnx.ix.com> REMOTE_MODULE command cp -r "/opt/demoServer/ipsc/dist" "/opt/apache-tomcat-base/webapps/ips" #USE_SHELL
...
changed: [md1cat01-demo.lnx.ix.com] => {"changed": true, "cmd": "cp -r \"/opt/demoServer/ipsc/dist\" \"/opt/apache-tomcat-base/webapps/ips\"", "delta": "0:00:00.211759", "end": "2016-02-05 11:05:37.459890", "rc": 0, "start": "2016-02-05 11:05:37.248131", "stderr": "", "stdout": "", "warnings": []}
What is happening is that there is never being a folder in that directory.
Basically the cp command is not doing it's job, but i get no error or so. If i run the copy command manually on the machine it works however.
Use Copy module and set directory_mode to yes

'An error occurred when executing the "'cache:clear --no-warmup'" command' with capifony

I am trying to deploy with capifony, but when I run
$ cap deploy
It returns an error
--> Updating code base with remote_cache strategy
Password:
--> Creating cache directory................................✔
--> Creating symlinks for shared directories................✔
--> Creating symlinks for shared files......................✔
--> Normalizing asset timestamps............................✔
--> Updating Composer.......................................✔
--> Updating Composer dependencies..........................✘
*** [err :: som.info]
*** [err :: som.info] [RuntimeException]
*** [err :: som.info] An error occurred when executing the "'cache:clear --no-warmup'" command.
*** [err :: som.info] Exception trace:
*** [err :: som.info] () at /home/yamaken/som.info/shared/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Composer/ScriptHandler.php:182
*** [err :: som.info] Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::executeCommand() at /home/yamaken/som.info/shared/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Composer/ScriptHandler.php:62
.....
This is my deploy.rb
set :application, "sommelier"
set :domain, "som.info"
set :deploy_to, "/home/yamaken/#{domain}"
set :app_path, "app"
set :repository, "git#github.com:haji/sommelier.git"
set :scm, :git
set :default_shell, "TERM=dumb sudo -u yamaken /bin/sh"
set :branch, "master"
set :scm_username, "haji"
set :scm_passphrase, "********"
set :use_sudo, false
set :user, 'yamaken'
set :model_manager, "doctrine"
# Or: `propel`
role :web, domain # Your HTTP server, Apache/etc
role :app, domain, :primary => true # This may be the same as your `Web` server
set :keep_releases, 3
set :shared_files, ["app/config/parameters.yml"]
set :shared_children, [app_path + "/spool",app_path + "/logs", web_path + "/uploads","vendor"]
set :writable_dirs, ["app/cache", "app/logs","app/spool"]
set :permission_method, :chown #
set :use_set_permissions, false
I have tried the code according to #nifr suggestion.
$ _DEBUG=1 cap deploy
Ruby Version => 1.8.7-p358
OpenSSL::Version => OpenSSL 0.9.8y 5 Feb 2013
Net::SSH::Version::CURRENT => 2.6.8
Net::SSH -> Local platform => unix
Password:
Remote Whoami => yamaken
umask on Server => 0022
$SHELL => /bin/bash
$BASH_VERSION => 4.1.5(1)-release
Interactive Shell - Test: $PS1 => no
* 2013-12-04 11:45:36 executing `deploy'
* 2013-12-04 11:45:36 executing `deploy:update'
** transaction: start
* 2013-12-04 11:45:36 executing `deploy:update_code'
triggering before callbacks for `deploy:update_code'
--> Updating code base with checkout strategy
executing locally: "git ls-remote git#github.com:haji/sommelier.git master"
command finished in 2798ms
* executing "git clone -q -b master git#github.com:haji/sommelier.git /home/yamaken/som.info/releases/20131204024539 && cd /home/yamaken/som.info/releases/20131204024539 && git checkout -q -b deploy 1ab8525ef883da0826b6b3d08a1c98da1904edd2 && (echo 1ab8525ef883da0826b6b3d08a1c98da1904edd2 > /home/yamaken/som.info/releases/20131204024539/REVISION)"
servers: ["som.info"]
[som.info] executing command
command finished in 24263ms
* 2013-12-04 11:46:03 executing `deploy:finalize_update'
* executing "chmod -R g+w /home/yamaken/som.info/releases/20131204024539"
servers: ["som.info"]
[som.info] executing command
command finished in 556ms
--> Creating cache directory
* executing "sh -c 'if [ -d /home/yamaken/som.info/releases/20131204024539/app/cache ] ; then rm -rf /home/yamaken/som.info/releases/20131204024539/app/cache; fi'"
servers: ["som.info"]
[som.info] executing command
command finished in 374ms
* executing "sh -c 'mkdir -p /home/yamaken/som.info/releases/20131204024539/app/cache && chmod -R 0777 /home/yamaken/som.info/releases/20131204024539/app/cache'"
servers: ["som.info"]
[som.info] executing command
command finished in 383ms
* executing "chmod -R g+w /home/yamaken/som.info/releases/20131204024539/app/cache"
servers: ["som.info"]
[som.info] executing command
command finished in 365ms
* 2013-12-04 11:46:05 executing `deploy:share_childs'
--> Creating symlinks for shared directories
* executing "mkdir -p /home/yamaken/som.info/shared/app/spool"
servers: ["som.info"]
[som.info] executing command
command finished in 370ms
* executing "sh -c 'if [ -d /home/yamaken/som.info/releases/20131204024539/app/spool ] ; then rm -rf /home/yamaken/som.info/releases/20131204024539/app/spool; fi'"
servers: ["som.info"]
[som.info] executing command
command finished in 373ms
* executing "ln -nfs /home/yamaken/som.info/shared/app/spool /home/yamaken/som.info/releases/20131204024539/app/spool"
servers: ["som.info"]
[som.info] executing command
command finished in 372ms
* executing "mkdir -p /home/yamaken/som.info/shared/app/logs"
servers: ["som.info"]
[som.info] executing command
command finished in 369ms
* executing "sh -c 'if [ -d /home/yamaken/som.info/releases/20131204024539/app/logs ] ; then rm -rf /home/yamaken/som.info/releases/20131204024539/app/logs; fi'"
servers: ["som.info"]
[som.info] executing command
command finished in 366ms
* executing "ln -nfs /home/yamaken/som.info/shared/app/logs /home/yamaken/som.info/releases/20131204024539/app/logs"
servers: ["som.info"]
[som.info] executing command
command finished in 376ms
* executing "mkdir -p /home/yamaken/som.info/shared/web/uploads"
servers: ["som.info"]
[som.info] executing command
command finished in 373ms
* executing "sh -c 'if [ -d /home/yamaken/som.info/releases/20131204024539/web/uploads ] ; then rm -rf /home/yamaken/som.info/releases/20131204024539/web/uploads; fi'"
servers: ["som.info"]
[som.info] executing command
command finished in 401ms
* executing "ln -nfs /home/yamaken/som.info/shared/web/uploads /home/yamaken/som.info/releases/20131204024539/web/uploads"
servers: ["som.info"]
[som.info] executing command
command finished in 375ms
* executing "mkdir -p /home/yamaken/som.info/shared/vendor"
servers: ["som.info"]
[som.info] executing command
command finished in 375ms
* executing "sh -c 'if [ -d /home/yamaken/som.info/releases/20131204024539/vendor ] ; then rm -rf /home/yamaken/som.info/releases/20131204024539/vendor; fi'"
servers: ["som.info"]
[som.info] executing command
command finished in 969ms
* executing "ln -nfs /home/yamaken/som.info/shared/vendor /home/yamaken/som.info/releases/20131204024539/vendor"
servers: ["som.info"]
[som.info] executing command
command finished in 366ms
--> Creating symlinks for shared files
* executing "mkdir -p /home/yamaken/som.info/shared/app/config"
servers: ["som.info"]
[som.info] executing command
command finished in 366ms
* executing "touch /home/yamaken/som.info/shared/app/config/parameters.yml"
servers: ["som.info"]
[som.info] executing command
command finished in 378ms
* executing "ln -nfs /home/yamaken/som.info/shared/app/config/parameters.yml /home/yamaken/som.info/releases/20131204024539/app/config/parameters.yml"
servers: ["som.info"]
[som.info] executing command
command finished in 393ms
--> Normalizing asset timestamps
* executing "find /home/yamaken/som.info/releases/20131204024539/web/css /home/yamaken/som.info/releases/20131204024539/web/images /home/yamaken/som.info/releases/20131204024539/web/js -exec touch -t 201312040246.11 {} ';' &> /dev/null || true"
servers: ["som.info"]
[som.info] executing command
command finished in 383ms
triggering after callbacks for `deploy:finalize_update'
* 2013-12-04 11:46:12 executing `symfony:cache:warmup'
--> Warming up cache
* executing "sh -c 'cd /home/yamaken/som.info/releases/20131204024539 && php app/console cache:warmup --env=prod --no-debug'"
servers: ["som.info"]
[som.info] executing command
command finished in 530ms
*** [deploy:update_code] rolling back
* executing "rm -rf /home/yamaken/som.info/releases/20131204024539; true"
servers: ["som.info"]
[som.info] executing command
command finished in 536ms
failed: "TERM=dumb sudo -u yamaken /bin/sh -c 'sh -c '\\''cd /home/yamaken/som.info/releases/20131204024539 && php app/console cache:warmup --env=prod --no-debug'\\'''" on som.info
I have another quesion, there is the way for not doing the line below after deploy fails?
executing "rm -rf /home/yamaken/som.info/releases/20131204024539; true"
If I can remain the fils on the server. I can check the cause by manual operation.
Debugging Capistrano deployments:
A little trick i came up with to ease debugging is to use an environment variable to switch verbose output and some extra information on and off.
You can add something like this to your deploy.rb (extend or shorten if you like)...
unless ENV['_DEBUG'].nil?
puts "Ruby Version => #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"
puts "OpenSSL::Version => #{OpenSSL::OPENSSL_VERSION}"
puts "Net::SSH::Version::CURRENT => #{Net::SSH::Version::CURRENT}"
puts "Net::SSH -> Local platform => #{Net::SSH::Authentication::PLATFORM}"
puts "Remote Whoami => #{capture 'whoami'}"
puts "umask on Server => #{capture 'umask'}"
puts "$SHELL => #{capture 'echo $SHELL'}"
puts "$BASH_VERSION => #{capture 'echo $BASH_VERSION'}"
puts "Interactive Shell - Test: $PS1 => #{capture 'if [ -z "$PS1" ]; then echo no; else echo yes; fi'}"
logger.level = Logger::MAX_LEVEL
ssh_options[:verbose] = :debug
end
Now execute:
_DEBUG=1 cap deploy

Unix troubleshooting, missing /etc/init.d file

I am working through this tutorial on daemonizing php scripts. When I run the following Unix command:
. /etc/init.d/functions
#startup values
log=/var/log/Daemon.log
#verify that the executable exists
test -x /home/godlikemouse/Daemon.php || exit 0RETVAL=0
prog="Daemon"
proc=/var/lock/subsys/Daemon
bin=/home/godlikemouse/Daemon.php
start() {
# Check if Daemon is already running
if [ ! -f $proc ]; then
echo -n $"Starting $prog: "
daemon $bin --log=$log
RETVAL=$?
[ $RETVAL -eq 0 ] && touch $proc
echo
fi
return $RETVAL
}
I get the following output:
./Daemon: line 12: /etc/init.d/functions: No such file or directory
Starting Daemon: daemon: unrecognized option `--log=/var/log/Daemon.log'
I looked at my file system and there was no /etc/init.d file. Can anyone tell me what this is and where to obtain it? Also is the absence of that file what's causing the other error?
Separate your args within their own " " double-quotes:
args="--node $prog"
daemon "nohup ${exe}" "$args &" </dev/null 2>/dev/null
daemon "exe" "args"

Resources