Programming in an Interpreted language executed by a running Shell

learn more… | top users | synonyms

3
votes
1answer
176 views

shell script (KSH) + set file to param & perform test between param and string

in my linux machine red-hat 5.1 - in ppp file - I have only the signature.pl string !!! remark - third application write the signature.pl string in to ppp file I set ppp file in $a param And ...
5
votes
3answers
2k views

“watch” command to notify on newly created files on linux

watch command to notify on newly created files on linux How to modify the below command to notify on creating a new file to /usr/local/mydir/ by linux user john ? watch -d 'ls -l /usr/local/mydir/ | ...
1
vote
2answers
3k views

How can I recursively delete old files and prune resulting empty directories?

We're using an AIX server to house thousands and thousands of little files in a nested directory structure. I'm trying to write a script that will recursively delete old files, and then delete the ...
0
votes
3answers
84 views

shell script + match MAJOR and CRITICAL strings from log file

I need to match lines that have MAJOR and CRITICAL strings that comes after the word ERROR:< any integer number > please advice how to do that with one awk or sed command? more HW_Log.txt ...
2
votes
1answer
452 views

Using Gentoo's `ebegin`, `eend` etc under Ubuntu

We're quite fond of the style of the ebegin, eend, eerror, eindent etc commands used by Portage and other tools on Gentoo. The green-yellow-red bullets and standard layout make for very quick spotting ...
0
votes
2answers
759 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 ...
1
vote
2answers
170 views

Does it make sense to copy files in parallel to the same NFS mount?

Here's an example: ( cp /tmp/one /nfs/one ) & ( cp /tmp/two /nfs/two ) & ( cp /tmp/three /nfs/three ) & ( cp /tmp/four /nfs/four ) & ( cp /tmp/five /nfs/five ) & wait Against a ...
1
vote
1answer
113 views

shell script + add inside the script PATH for standard output

Usually if we want to redirect script output to file we simply do /etc/create_connection.sh > file.debug.txt Or /etc/create_connection.sh | tee –a file.debug.txt But What I want is ...
1
vote
1answer
60 views

Bash: checking uniqueness of filenames, and renaming or removing files

I'm working in CentOS with bash and I have files in a directory as follows: 16948.png 16948_thumb.png 16948-1_thumb.png 16949.png 16948_thumb.png 16949-1_thumb.png 16950-1.png ...
1
vote
2answers
857 views

Shell script to start mysql server if not already running

I have a shell scipt and at some point I want to check if mysql is running and start it if it's not. I'm trying the following, but not having any luck: set mysqlstatus = `sudo ...
0
votes
1answer
229 views

Running root script upon ssh'ing as a particular user, but not upon standard login

I would like to do the following : If I login as user ABC via the login screen, do nothing. However if I ssh as ABC, then I want to run a root script, without being prompted for roots password, and ...
0
votes
2answers
2k views

How to fetch lines between two strings using shell script?

How to fetch lines between two strings using shell script? For example I am having a file called file_text.txt as below. MEDIUMINT CREATE ( MAXVALUE MEDIUMBLOB MEDIUMINT MEDIUMTEXT MIDDLEINT ); ...
4
votes
3answers
969 views

Bash-Scripting - Munin Plugin don't work

i have written a munin-plugin to count the http-statuscodes of lighttpd. The script: #!/bin/bash ###################################### # Munin-Script: Lighttpd-Statuscodes # ...
0
votes
1answer
679 views

What version of ksh ships with AIX 5.3?

I'm writing a Korn shell script for a client, who will use it on AIX 5.3. For testing, I'm using version 93u-1 Debian Wheezy. Is this the same version as the one I'll find on AIX?
1
vote
3answers
812 views

Shell Script for Sending output or log via email

I want to know if it is possible to get my backup script output or any of its errors via email using google (or any other SMTP server). I don't want to install a mail server on my local machine. What ...
0
votes
2answers
2k views

How to determine the block device booted from in a shell script?

I'm crafting up a shell script (to be called by cron) that runs smartctl on the booted disk on a weekly basis. Is there a fairly universal way to determine what the boot block device is (IE - ...
0
votes
2answers
482 views

Shell script to change uid for user

I have a file (users_uid) with users and uid are two parameters as given below : assds 611 dsdsd 612 xyzx 613 rerer 614 These users exist in the machine. I want to change the ...
3
votes
4answers
3k views

From a shell script, how can I check whether a table in MySQL database exists or not?

I am trying to write a script which allows a user to select the what manipulation he needs to do on a table. I want to check if the table exists or not. If it exists I will continue the other things ...
0
votes
2answers
97 views

OS X Server script to archive (or empty) a users mailbox every morning

I have a requirement (SpamAssassin 'training') to archive (or delete) two user's (users are junkmail and notjunkmail) inboxes at a given time every day if there is anything in them. Can anyone help ...
0
votes
2answers
123 views

export command within shell script

When I use export command at command prompt, it works as expected. But it does not work from shell script. [root@server shantanu]# export myip=10 [root@server shantanu]# echo $myip 10 [root@server ...
-3
votes
2answers
256 views

How to sync windows server folders with a AIX server using script?

Everyday I would like to sync the files and folders in the windows server with AIX server and vice versa. Does anyone suggest me, How I can write a shell or bat script to achieve this?
0
votes
2answers
50 views

Highlight code line by line

Following is the shell script that is expected to pick one line at a time from a given file highlight it. #!/bin/sh > myhighlight.txt file='to_study.php' cat $file | while read -r myline do export ...
1
vote
3answers
298 views

scp with password less authentication

scp with password less authentication is working fine but if delete a file on the source it will not get replicated ie the destination directory is not completely replaced with source. I can see the ...
0
votes
1answer
707 views

window shell (batch) script to list files changed since yesterday

Any example of windows xp dos script(.bat) that when run will iterate all subdirectories and list all files that have date updated since yesterday time?
0
votes
1answer
484 views

RSync shell script failing to run as CRON, runs fine manually

I have a simple shell script that runs Rsync. It runs fine if I call it manually from the command line, but when I set it up as a CRON job I get the following error: rsync: failed to open exclude ...
0
votes
1answer
980 views

including the current directory in a .reg script

I have a .reg script: Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SeleniumRC\Parameters] "Application"="C:\\Program Files ...
0
votes
1answer
282 views

shell script won't work in cron

I have very smiple script to do a backup, and it is working fine when I run it from the command line, but I am having problems running it as cron job. My cron entry is this: (running it every minute ...
0
votes
2answers
707 views

How can I script creating email aliases for existing mailboxes in Exchange 2003?

I need to create lots of email aliases (more than I want to do manually), so I want to know if there's a way I can script the addition of aliases to existing mailboxes/users. I don't mind if I have to ...
3
votes
1answer
533 views

How can I output the chkconfig results to a file within a shell script?

When I run the following from the linux command line it works properly and populates the chkconfig.bak file correctly : #chkconfig --list > chkconfig.bak But when the command is run from a ...
2
votes
6answers
112 views

Copying files from a server to a set of machines

First of all I am not a trained professional in Networking nor I know much about it. I have some knowledge of GNU/Linux, Shell scripting. One day I wanted to copy a large zipped file to a set of ...
1
vote
3answers
114 views

Copy all files to another location [closed]

I have a folder called "employee" and within that folder there are sub-folders with each employee name. employee >> amar >> akbar >> anthony Each of these folders contain 1 or 2 ...
1
vote
2answers
216 views

Why is this bash script not working?

I'm making a bash script which checks the available space on disk: if [ check_space -gt "85" ]; then echo "removing" else echo "not removing" fi check_space returns a number like 52 and the ...
-1
votes
2answers
145 views

Would it be better security to write a backup script in PHP or shell? [closed]

I have a server running Ubuntu 10, it mostly has PHP websites with MySQL databases. I need to write a backup script to backup the database to zip up all the php files. Is it better security to ...
0
votes
2answers
783 views

Commands /etc/init/boot.local get started before some environment variables get initialized

I have OpenSuse 11.4. I start some on-boot scripts inside /etc/init/boot.local. Where could I move those scripts so that they would be started after all (most) environment variables got initialized? ...
1
vote
1answer
154 views

export_bashrc() bash function to export .bashrc to a server

I am trying to write a bash function shown below.I am trying to scp my .bashrc to the target machine.I want to do modify the following function in the below two ways. 1.I want to enter the password ...
3
votes
2answers
248 views

Measuring “loading time in milliseconds” every minute

I have apache running on a virtual server, which in periods gives very bad performance - even when retrieving static JPG or PNG files. This only happens once in a while, so it's hard for me to ...
0
votes
2answers
827 views

Set up a linux shell script cron job on Plesk 9.5.4

Operating system Linux 2.6.18-028stab089.1 Parallels Plesk Panel version 9.5.4 Set up a test cron job in Settings>Scheduled Tasks>user "root"> * * * * * /var/www/cron/webcrontest.sh ...
2
votes
1answer
1k views

problem executing a bash script with utf8 encoding

I have a bash script encoded in utf8 . Within the script i use sed command using § as a separator . Now when i run execute this script sed complains about the separator. If i use normal char as a ...
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 ...
4
votes
2answers
710 views

Shell script: Find entries in access log with 500 response within a specified date period

Can someone help me with a shell script to figure out the number of 500 HTTP response entries in an access log within a time frame specified?
6
votes
2answers
2k views

How to grant sudo rights only to specific script files?

I would like a user to have sudo rights (without password check) to a couple of shell scripts under a specific directory (in my case, /usr/local/tomcat7/bin), and to nowhere else. What's the simplest ...
2
votes
1answer
97 views

Move all files to their own folder

Is there any way on a linux box to move every file in a directory into their own sub directory (i.e. make a directory named after it and move it in)?
1
vote
2answers
333 views

How to find the IP address of the local Linux workstation

I am creating a shell script that should do some local settings and echo the IP of the machine in a text file. The reason I need to do this is to get the IP in a PHP script and use it from there as ...
1
vote
1answer
464 views

(Ubuntu) How to configure startup application?

I'm trying to configure the startup application in Ubuntu. I want to perform the following tasks in sequence when a user login to Ubuntu's desktop: Ensure that the webserver is started ...
2
votes
2answers
3k views

Linux FTP upload: “No such file or directory”, but file exists

I want to upload backup archives from one server to another server using ftp. In my backup cronjob I use this script to upload files: MEDIAFILE=/var/somedir/somefile.encrypted if [ -r $MEDIAFILE ] # ...
11
votes
4answers
2k views

Can a shell script wait for a file to change and take action?

I wonder if I can write a script that will monitor for a change in a file and execute some action when the change is detected. Detailed explanation: OpenVPN writes its status to a file every 1 ...
2
votes
1answer
752 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 ...
0
votes
2answers
149 views

Cannot log into mysql after invoking mysql from shell script

(My first question here, so if I am flouting any conventions, I apologize in advance!) This is my first attempt at creating a shell script. I am trying to create new databases and users and passwords ...
1
vote
1answer
1k views

PAM: How can I create a service which passes username/password to a script?

I'm setting up a PAM service for OpenVPN, such that the OpenVPN PAM module can authenticate a username/password to an external service that I will implement using a shell script. The OpenVPN PAM ...
1
vote
2answers
415 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 ...