Programming in an Interpreted language executed by a running Shell

learn more… | top users | synonyms

-4
votes
0answers
22 views

Delate nessages in Gmail “All” or “Outgoing” folder [closed]

I use one Gmail account only for mail relaying from my home server to different accounts, to multiple users. The problem is that there are some thousands of emails on this account in "Sent" and ...
1
vote
0answers
45 views

Powershell-Script is not exectued correctly

I have a power-shell-script which is called by a batch-file. The batch calls the script after it has set the execution policy to unrestricted. Currently the script does nothing more than writing a ...
13
votes
4answers
32k views

How do I sleep for a millisecond in bash or ksh

sleep is a very popular command and we can start sleep from 1 second: # wait one second please sleep 1 but what the alternative if I need to wait only 0.1 second or between 0.1 to 1 second ? ...
1
vote
1answer
35 views

Mysql optimize one table in all databases

I see in the mysqlcheck manual that there's an option for --tables that overrides that databases option, but it isn't well explained. I'm trying to run mysqlcheck -o and I want it to optimize a ...
-1
votes
1answer
99 views

Bash Script - Expect does not send password that ends with $!. Also need improvement to report connection timed out

Update: Password issue is fixed and connection timed out message was fixed too. Adding \ before $! worked. Example: *password\$! set passwds { *password\$! @tempP@ss %Test4%} For connection timed ...
3
votes
3answers
52 views

How to pass command output as several arguments to another command

I have a command that produce a output like this: $./command1 word1 word2 word3 I want to pass this three words as arguments to another command like this: $ command2 word1 word2 word3 How to pass ...
1
vote
1answer
58 views

Operator \> and \< (string version comparison) are not recognised in shell script

I am trying to run Casandra nodetool and getting warnings coming from .sh script. [root@d11ca4cc-fa95-c8a9-e133-e64c434f0e6f ~]# nodetool status /opt/local/share/cassandra/bin/nodetool[53]: .[97]: ...
-1
votes
2answers
103 views

Delete all files except the newest of each day

I have dump directory that is filled at the rate of one file per 4 hours. I wish to keep all files for a week then delete all except the newest of each day. Bash is preferred though other solution ...
0
votes
3answers
72 views

how to run the dialog command with proccess

Please look on my code – ( bash script ) I want to display both dialogs on the screen on the same time, one dialog display the: tail –f from - /var/log/proccess1.log , and the second dialog ...
0
votes
2answers
49 views

While loop does not return control

The following shell script works only for first server and does not loop to the next. I tried 0< before the ssh command but it still does not return to the shell script once connected. #!/bin/sh ...
0
votes
1answer
54 views

Cronjob for a bash script pauses for 2 minutes randomly

I have been running a bash script on CEntOS 5.5 machine that checks replication on a remote mysql server. The script creates a temporary lock file and is scheduled to run in Crontab every minute. But ...
0
votes
0answers
48 views

Bash and background processes PGID and receiving signals

My actual problem is that a process I run in an rcfile in docker as docker run container bash --rcfile rcfile remains attached to the bash session by sharing the PGID which means that when I Ctrl-C an ...
1
vote
2answers
130 views

Which open source program is similar to the Linux “dialog” command? [closed]

The linux dialog command is a great tool for creating dialog boxes in terminal windows (e.g. in a bash script). However, there is a drawback of dialog which is that the window is always positioned in ...
3
votes
1answer
90 views

How to view two dialog boxes on the linux console, running on the same time?

I want to view on the Linux console two dialog windows on the same time. I want a window that views the progress BAR, and the a second tailbox that view the logs are running. The problem is that the ...
0
votes
2answers
126 views

Bash: Execute command from variable without eval

I have a problem with a script which should execute a curl command composed from the given arguments. It works if I use eval in the subshell, however, I would like to avoid that as it seems to be bad ...
4
votes
2answers
3k views

Unix separate multiple commands which has '&' (execute in background) in the end

To separate regular commands in Unix is to put semicolon in the end like this: cd /path/to/file;./someExecutable; But it seems not working for commands like this: ./myProgram1 > /dev/null & ...
-1
votes
2answers
161 views

Read mail from Postfix using shell script [closed]

I would like to be able to read incoming mail from a Postfix MTA using a shell script. The shell script should be able to retrieve the mail headers, subject, body, attachments, etc., then mark the ...
1
vote
3answers
1k views

Running ssh-agent from a shell script

I'm trying to create a shell script that, among other things, starts up ssh-agent and adds a private key to the agent. Example: #!/bin/bash # ... ssh-agent $SHELL ssh-add /path/to/key # ... The ...
0
votes
1answer
128 views

unable to run the script in linux using plink

I'm unable to run a script in linux using plink.exe. I'm using my user x to login and script is under y user, which I need to sudo to y and run it. I was able to at command prompt manually but not ...
-2
votes
1answer
56 views

how to write a script to get ifInOctets and ifOutOctets? [closed]

Can any one help me with writing a script to get ifInOctets and ifOutOctets from a server 10.38.2.24 ? I need help
0
votes
1answer
66 views

Bash function hangs while command run perfectly without function

Following function hangs : ssh() { local RESULTS; RESULTS=$(ssh $USERNAME@$SERVER $SSH_COMMAND1); echo $RESULTS; } ssh; while if i run following commands they work fine : ...
0
votes
1answer
389 views

Passing variables in kickstart

I have a kickstart file that takes a hostname in the %pre section. I cannot seem to figure out how to get it two the first. As you see it sends the server information to another device which then ...
0
votes
1answer
297 views

ways to automatically fix line endings in shell scripts or files who break with ^M

Problem We regularly break our files lines endings and things stop working without us noticing. Bash complains about "invalid option" or ": command not found" as described here: ...
3
votes
3answers
527 views

Year Month day from file name in shell script

I hava file names like below adn_DF9D_20140515_0001.log adn_DF9D_20140515_0002.log adn_DF9D_20140515_0003.log adn_DF9D_20140515_0004.log adn_DF9D_20140515_0005.log adn_DF9D_20140515_0006.log ...
1
vote
1answer
164 views

Replacing LineFeed \x0a with SED

I have to delete lots of Linefeeds (Hex \x0a) in a logfile. I just have sed to solve the problem. It is a bit complicated I know.. Do you have idea how to solve the problem? Here is an example ...
0
votes
2answers
235 views

Moving files using sftp

I am trying to move files from one location to another on the remote server using sftp below: for i in a b c d do sftp $REMUSR <<EOM>>$OUT 2>&1 rename ...
2
votes
2answers
920 views

Can I change the ownership of all the files of a specific user?

Is there a way to recursively find all files owned by a user and change them to another user/group in Gnu/Linux? I assume there must be some magic one liner but my command line wizardry skills are ...
2
votes
3answers
12k views

How to run a script automatically on system startup in centos

I've successfully installed TeamCity ib CentOS 6.2 Minimal. I'm stuck on trying to run a script automatically on system startup: /opt/TeamCity/bin/teamcity-server.sh start I've googled around and ...
0
votes
1answer
91 views

How do I write a script that compares folder/symbolic-link names from two diffrent folders?

I need help in writing a script to create symbolic links. Here is a script that I have been running on background. #!/bin/bash SOURCE="/home/$USER/www" DEST="/var/www" while true; do find $SOURCE ...
0
votes
3answers
166 views

Bash script: compare paths issue

I'm working on the bash script that iterates over the list of files. I need to compare the paths to this files with the array containing the restricted paths. Inside the for loop I get a path to a ...
2
votes
1answer
37 views

Inspecting how $PATH gets created

Is it possible to "listen" to a variable's value during the start of a new shell? I have a script that checks for the $PATH variable in the typical places, but I'd like to try something different. ...
-2
votes
1answer
33 views

Ubuntu shell: Get tomorrow's weekday [closed]

I have a shell script for backups and I need the Weekday of tomorrow. $Today = $(date +%a) #$Tomorrow = ?
0
votes
3answers
305 views

Exclude with the find command [duplicate]

I need some help getting the find command to work right in a script working on. I need to be able to exclude some directories. Below I have what I'm doing as a work around. sudo find / ( -name ...
4
votes
1answer
421 views

Shell script: the child process do not terminate in linux

I have written a shell script to initiate three background process in the same time. In shell script I am trying to wait for all children to finish their job and then the parent job to terminate. But, ...
0
votes
2answers
369 views

Script for search string inside the file for every one hour

I need to write a script where the particular string(alphanumeric) should be searched inside the file with every hour for whole day. And the search should not contain the previous hour results. Time ...
2
votes
1answer
492 views

Terminate remote process when backgrounded ssh session is terminated

So right now I have a bash script that runs a command on a remote machine using ssh. The machine running the bash script is a Linux machine and the remote machine is a Windows machine running cygwin. ...
1
vote
2answers
4k views

Cannot get Exchange PowerShell script to run under Scheduled Tasks

I have a PowerShell script that works when entered directly into the PowerShell. The PowerShell program is run with the shorcut: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe ...
1
vote
1answer
735 views

pam_exec.so PAM module does not export variable PAM_USER as stated in the documentation

I'm trying to use the pam_exec.so PAM module to execute a script which needs to know the username/password coming from the application (OpenVPN in this case). I have a script that executes printenv ...
1
vote
1answer
539 views

Script Shrew VPN

I have the Shrew client installed in order to connect to a cisco VPN. (side note: anyconnect royally blows and I spent several hours trying to get it to work; I had shrew running within 2 minutes ...
0
votes
2answers
746 views

rsh for windows 7

I am looking for rsh client for windows 7. It should be GNU. I also can't run setup on that machine, so this file must be copied. Reasons: I had a windows XP batch file with rsh commands that ...
0
votes
2answers
2k views

syntax error near unexpected token `then'

I created bash script wich works as Nagios plugin. Here is a part of it: 44 CURDUPLEX=`ethtool $IFACE|grep "Duplex"|cut -d ':' -f 2|xargs` 45 CURSPEED=`ethtool $IFACE|grep "Speed"|cut -d ':' -f ...
2
votes
3answers
1k views

power shell error: Cannot bind parameter

when i am trying to execute the below PowerShell command, i got error . The command : *PS cert:\currentuser\authroot> gci | where subject -like "UTN"* The error is below : Where-Object : Cannot ...
1
vote
2answers
379 views

Unix quota per user script

Is there any way to automate user's home folder qouta by script. I have auto useradd script, and I want to add code in script about quota for home folder of size 2 GB. For example: edquota sally ...
0
votes
2answers
82 views

redirect command executed along with output shell

I would like to redirect the command executed along with the output to a file. for example: #ls >ls_out.txt ls_out.txt should be something like : ls file1 fil2 Thanks!
-1
votes
2answers
145 views

Run a script on ssh login

I have a development env. with 4 users, I want to be able to log their time logged in since they are contractor working from home. I have NO idea how to do it, my sys admin left me this weekend and I ...
1
vote
3answers
1k views

LDAP Account Expiry Script Help

I need to find a way of automatically notifying LDAP account users as to when their passwords will expire and also force them to change their passwords. I am fairly new to LDAP.I am running openldap ...
1
vote
1answer
102 views

Wrangling sed to find and reformat login date (or, how to kill idle mosh-server processes)

I have an old method of killing idle mosh-server processes, which doesn't work on my new VPS. Here's the old method, which I run in root's crontab to clean up mosh processes that have been idle for ...
1
vote
2answers
2k views

Incrond running but not executing commands CentOS 6.4

I have copied this question over here from StackOverflow... I have installed incron from the EPEL repository (0.5.9) (before you ask; YES, I also tried downloading the source and compiling locally ...
0
votes
3answers
1k views

Global Redirection of port 80 to 443

I'd like to setup my linux box so that anything hitting port 80 would simply be told ask that of 443. I want it to be regardless of domain, IP or whatever specific details may exist. If it can be ...
1
vote
3answers
534 views

How to start Rails from a shell script on Debian?

I don't really have any need to mess with passenger or capistrano at the moment. I simply want to run rails on boot on port 3000. I've attempted to replicate this tutorial for node as much as I could ...