Questions tagged [unix-shell]
124 questions
1
vote
1 answer
How to reliably & portably serialize binary information into POSIX shell
Problem context
I am trying to implement a job orchestrator whose agent/worker programs, connect to machines via an SSH session/shell. I would like to transfer (potentially binary) files to these agents (which could be needed for any sort of…
Daniel Gray
- 127
- 1
- 1
- 5
1
vote
3 answers
Avoid to write clear password in a sh script
I'm writing shell script on my custom board. In this script I use openssl to encode file at runtime using this command:
openssl des3 -salt -in file.txt -out my_file.des3 -k my_password
Is there a way to avoid to write clear password in a sh…
init
- 11
- 2
0
votes
1 answer
While schedule below script through crontab receive incorrect output date format is going wrong
PFB script
dd=$(perl -e 'use POSIX;print strftime "%Y%m%d",localtime time-172800;')
Date=$(perl -e 'use POSIX;print strftime "%d%m%Y",localtime time-172800;')
for i in `cat /path/Path_CDR.txt`
do
cd $i
compress event*$dd*.asn
compress…
Gunnar02
- 1
- 1
0
votes
3 answers
"\" missing in ksh output
I have written a small script as follows
#!/usr/bin/ksh
cat test |while read line1
do
echo "$line1"
done
The input file "test" has the following lines
Kensington K64391US C\i70 Wireless
Desktop Nintendo Wii Wireless Nunchuck
\M470 DeLonghi…
Ashu
0
votes
0 answers
cron job not working in unix but works when executed manually
I am running a cron job everyday at 21:00 UTC which downloads few csv files from sftp server, renames the downloaded files and then loads the files in database(mysql) and updates the time in database (mysql).
ps -ef | grep cron | grep -v grep
root …
Roy
- 1
- 1
0
votes
2 answers
AWK, cut or ced...double parsing mail log to get authentication failures
I would like to parse mail log files, which originally look like this:
2018-10-23 23:27:51,026 INFO [ImapServer-4] [ip=10.10.11.50;oip=168.232.24.2;via=10.10.11.50(nginx/1.7.1);ua=Zimbra/8.8.7_GA_1964;cid=127325;] imap - authentication failed for…
Labsy
- 43
- 1
- 8
0
votes
2 answers
How to print true if condition in shell script
I'm writing a script to change few setting according to location and to do this i selected hostname as a benchmark. My aim is, if my hostname condition comes true then do this. For this i'm writing a shell script which is comparing few thing in …
root
- 39
- 2
- 8
0
votes
1 answer
getting multiple issues while creating a scrip to update hostnames in /etc/hosts file?
I'm completely new to the scripts and hence need help to fix this.
We've around 3000 VMs & 450 Physical servers which are Linux based servers (few of then ubuntu starting from 9.x & few of them are Susu starting 8.X & majority of them are RHEL…
Hrish
- 87
- 1
- 8
0
votes
1 answer
FreeBSD script - different result to manual execution (tcsh)
This question has been asked previously in https://joomla.stackexchange.com/questions/20697/securing-a-joomla-installation-on-apache-mod-php but it may belong here better since it is not Joomla specific.
I'm trying to execute a script in tcsh, and…
ExternalUse
- 165
- 1
- 7
0
votes
2 answers
LD_LIBRARY_PATH Configuration Setup Issues
I am facing a weird but a sensible issue, I have 2 ORACLE_HOMEs, 1st one points to ORACLE Database Software and 2nd one points to ORACLE Client Software.
Why I am forced to do this - reason is: In my system Pro *c is getting compiled from ORACLE…
Gaurav Bhaskar
- 43
- 7
0
votes
1 answer
Continuously save tail of standard input
I have a program that generates large logs on the standard output. Actually I don't care about the log, but I do want to know the last 1000 lines or so if the program finishes or crashes.
I want something in-between "tail -f" and "> log".. that is…
steve00
- 1
0
votes
1 answer
How to repeat a command, like a backreference, at the cli?
What I'd like to do is run the same command twice while hitting enter once, with minimum typing. This would be the long version for example:
# sudo puppet agent -tv --server foo.bar && sudo puppet agent -tv --server foo.bar
I thought about
# sudo…
spoovy
- 334
- 4
- 14
0
votes
2 answers
Unix: How to find the name of the ethernet interface through which I'm logged in
We have multihomed servers. And to simplify things, I would like to know the dns of the interface trough which I'm logged in. (e.g. to set PS1 thus it can be used in scp commands)
My solution for that problems seems to be rather complicated.
=> is…
Thomas SV
- 53
- 5
0
votes
1 answer
remote script execution from local script linux doesn't stop for remote script prompts
script abc.sh is on machine M1 and xyz.sh is on machine M2
script abc.sh:
#!/bin/bash
ssh -l user1 host.com ./xyz.sh -b1 arg1 -b2 arg2
script xyz has certain user prompts like pwd etc
When I execute script bc.sh from machine M1, it keeps looping…
S.Singh
- 1
0
votes
2 answers
How to compare timestamp of same file residing in two diff directories
I have a requirement like following:
I have two dir: DIR1 and DIR2. Files of DIR1 are updated on a regular basis based on requirement. Then updated files are copied to DIR2. So I need to write a shell script which will tell us whether all the files…
Prasenjit Patra
- 61
- 2
- 3
- 4