General :: Bash Shell Script To Check / If Empty Files Are Being Created & Start Process

Jun 25, 2010

I have an Ubuntu server in which a file is dumped every hour and a new file for the next hour and the process continues. If there is any problem due to which the creation of file stops then empty files are created every minute till the process is killed & started again. I need help to make a shell script to check if the empty files are being created and then kill the process and start it again.It would be a great help if anyone can help me regarding this.

View 9 Replies


ADVERTISEMENT

General :: Bash Script - Check Process Is Running, If Not Start?

Feb 7, 2010

I am using Sphinx search on my webserver and it quits after a certain amount of time leaving my search page broken.Here is a bash script that I want to run every 10mins via cron:

Code:
#!/bin/bash
if pgrep searchd | grep "[0-9]"

[code]...

View 24 Replies View Related

General :: How To Check Folder If It Has Files In It Using Bash Shell Script?

Aug 4, 2010

there is a folder. Its empty. When every I drag a new file and put into it it echo out "there is file in there" and keep monitoring the folder. How can I do it?

View 7 Replies View Related

General :: Process Billions Of Small Files Using Bash Shell Commands With Limited Memory?

May 26, 2010

I need to process billions of small files using bash shell commands with limited memory size (256MB). If any of those files contain certain "keywords", the file will be removed. I tried with command:

find . -type f -exec grep -i -l -H "keyword" '{}' + | xargs rm -rf

where all files are located within the current directory. But the command above failed in "out of memory".

View 1 Replies View Related

General :: Check From Application Serverthat Is There Any New Files Created Today In The AAA Directory?

Aug 16, 2010

I have backup_server and application_server.backup_server has directory AAA. I need to check from application serverthat is there any new files created today in the AAA dirctory. if yes, all files were created today or partial files?.

View 10 Replies View Related

Ubuntu Servers :: Server Process Created Files Permissions

Nov 20, 2010

Currently have access to a VPS where we are running a small game server on ubuntu - the problem is that it is a multi-user environment, so when one person restarts the server process, all files it creates are owned by that users name and group. I have created a group called 'game' and added both users to it, but I need to know how to make all files in the game server's directory to be r/w/x for the group 'game'. Currently, I have a script that chowns and chmods all files recursively on startup, but I'd prefer not having to do this.

View 4 Replies View Related

General :: Bash - Rename Files With Spaces Using System Shell?

Jun 8, 2011

I named a number of files with spaces in them, and I want to replace the space with "_". However, every time I write a command in the shell with the file name (eg "Spring 2011"), the shell doesn't recognize the file or directory. What can I do about this? Is there any way to use the unicode character for a space?

View 5 Replies View Related

Software :: How To Check Which Script Start Process?

Sep 7, 2010

When my system starts this command is executed by a script /usr/sbin/apache2 -k start...How can I find which one start it? I check in rc2.d/ dir in the apache script but didn't found anything similar. Where else should I look?

View 7 Replies View Related

General :: Wget Showing An Empty File Being Created At Root On Every Run?

Feb 19, 2010

I have set up a cron job in linux server using the command 'wget -q -o wget_outputlog url'

But on every run, an empty file being created at root.

How to stop this.

View 6 Replies View Related

Programming :: Shell Script To Monitor Files Created On A Folder

Aug 27, 2009

Can someone please help me on how can i create a script that will monitor file creation on a single folder and sending the newly created file on a separate folder? Only the new created file must be transffered or copied to the other folder. The old ones remains.I urgently need this for production deployment.

View 8 Replies View Related

Ubuntu :: Created A Little Bash Script For Renaming Files From A Folder?

Feb 28, 2010

I created a little bash script for renaming files from a folderEvery time i hv to put that bash script file (rename.sh) in folder Is there any ways i will call (rename.sh) from terminal without moving rename.sh into any folder ?ne More Question : Whenever i run any .sh file automatically one .sh~ file created it is my programing mistake or is it exists ?

View 7 Replies View Related

Ubuntu :: Shell Script Using Bash / Get The Date Of The Process Takes Longer Running?

Mar 29, 2010

I need show the number of process per user, and after the date of the oldest process per user also.

With "ps -eo user | sort -u" i get all users that are running any process. And with "ps U username | wc -l" i get the number of process that the user "username" is running.

But how can i merge both commands for do what i need? Like a FOR or something like that. There is any method of make a FOR using the list that i get with the first command?

And then for show the date of the oldest process.. with "ps U username | sort -k 4" (4 is TIME field) i can show the process of the user "username" sorting they by time. But how can i get the date of the process takes longer running?? I can get only the time, but no the date.

View 9 Replies View Related

Programming :: Start A Process And Send Input To It In A Shell Script?

Jun 9, 2011

I'm building a Linux From Scratch system and partially automating it. I will likely want to do it again, and I would like to try to almost completely automate it.

My current approach is a script that takes an input file and sequentially runs each line in a new instance of bash. If one fails, it gives me the number of the step that failed so that I can use the "--step" option to resume after I fixed the issue.

This has some problems:
A varible created on one line will not be accessible on the next line. This is because each line is run in a separate shell (the reason for this is so that the commands in the input file and the script's internal variables can't interfere). You can't switch users or use chroot, again because each line is run in a separate shell.

What would be nice is to be able to start a bash process in the background and send commands to its stdin. I guess that a named pipe would work, but the named pipe will be gone after a chroot. Is there a way to do it without relying on the filesystem? Also, how do I know if the command failed?

View 14 Replies View Related

Software :: Bash-script : Start A User A's Process From Other Users?

Aug 26, 2010

A Tomcat server is installed under user A. Now I am going to write a script which will start this Tomcat server. And this script can be executed from other users (from there account). And if other user run this script, the process ID should be of user A, so that user A can start or stop this process any time. This means, at the beginning of the script I have set the process ID as user A. How to do this?

View 8 Replies View Related

General :: Can I Do Integrity Check When Tar.gz File Is Created?

Mar 25, 2011

create one tar.gz file that contains my /home, /etc, /root directory.

a) The process ended with a 88GB file size (which is ok) but with the following message.Code: tar: Exiting with failure status due to previous errors.I have searched a little but I could not find what went wrong.

b) What are the limitations of tar and gz for backups. Of course I fully understand that they can not be used for differential backups (if it is called like that)

c) Let's say that my backup will be a file of 100GB and I want to see the contents of the .tar.gz. In kde there is a program called ark. Can ark handle so big files? Does it use my hard disk (eg. /tmp) to uncompress the file so to show me its contents? It might be the case that might be the compressed file is much bigger than the left space on the hard disk?

d) How can I do an integrity check when my tar.gz file is created?

View 11 Replies View Related

General :: Check When A User Was Created,but Got No Answer?

Jul 14, 2010

tried a lot to get an answer for howo check when a user was created,but got no answer. know the command or how to check when a user was created?

View 14 Replies View Related

Ubuntu :: Write A Bash Script That Will Check If XMBC Is Running If It Is Then Do Nothing Else Start It Then Do Some Other Things?

Jul 23, 2011

<edit>never mind dump the ;'s and it all works fine</edit> I'm trying to write a bash script that will check if XMBC is running if it is then do nothing else start it then do some other things.This is the start

Code:
#!/bin/bash
DISPLAY=:0.0

[code]....

View 2 Replies View Related

General :: Filesystems - How To Find Which Process Had Created Any File

May 16, 2011

Is there any way to know which process had created any file in Linux Red Hat/CentOS 5?

View 2 Replies View Related

General :: Printing From Bash Shell / Concatenate Files Into One File With File Names Included?

May 11, 2011

I am supposed to take some small files, and print them to a specific printer, such that the small files are concatenated into one file. The file name has to be included in the file that gets printed.

Should I be looking to concatenate the files into one file with the file names included, and then print them?

something like: -printfunction -printername < file*

View 7 Replies View Related

Programming :: Bash Script To Check How Many Files In Directory?

Jan 31, 2009

i was wondering if there's a bash script to check the amount of files in a directory with an IF statement..

View 8 Replies View Related

General :: Empty Bash Command Line?

Sep 28, 2010

I am looking for a way to delete the currently entered commandline without wasting seconds on the "Backspace"-key.

For example I scrolled the bash history and have a long commandline that would execute when I pressed ENTER:

~$ aptitude search openssl | grep dev

But now I decide that I do not want to execute this command. Can I get an empty prompt fast without deleting the whole line with Backspace? On the Windows "cmd" you can just press ESCAPE and it is gone. This behavior would be what I want.

The question may seem trivial but this is bothering me for a long time now.

View 2 Replies View Related

General :: Replacing Empty Values In Bash?

Mar 11, 2011

I'm executing the below bash script, but when the m variable doesn't get any value it becomes empty. I don't want that.

Code:
for i in "$@"
do
m=$(grep TOTAL_MAPS $i | awk '{ print $2}');
totalmaps+="<string>"$m"</string>"

[Code]....

View 6 Replies View Related

General :: Shell Scripting \ (test If A File Is Empty, If It Is Then Display "file Is Empty" Otherwise Display "file Is Not Empty")?

Oct 5, 2010

I am a final year student doign Computer systems engineering and just been introduced to linux. While still strugling to catch up with the commands, I am now given an assignment under shell scripting.I seriously am strugling to understand this question, can you please assist me.Here follows the assignment:

Operating Systems III
Some tips
e.g. (test if a file is empty, if it is then display "file is empty" otherwise display

[code]....

View 10 Replies View Related

Fedora :: Created An Empty Qt Projet And Added A Main.cpp?

Feb 18, 2010

I installed qt-creator 4.5.3 in fedora 12 (gnome) . I then created an empty Qt projet and added a main.cpp as below

Code:
#include <QApplication>
#include <QPushButton>

[code]....

View 2 Replies View Related

Ubuntu :: Bash Script - Start A Process Then Close Terminal With In The Script?

Jan 1, 2010

I have got a bash script i have been playing with I need to start a process then close terminal with in the script but leave program running ?

Code:
#!/bin/bash
sudo ifconfig eth0 down
sleep 5
sudo ifconfig eth0 up
firefox & exit

View 9 Replies View Related

Fedora :: Modify Start Up Files Of Sh-based Shell

Sep 2, 2011

i need to add a line in the login start up file(s) (one of ~/.bash_profile, ~/.bash_login, or ~/.profile) and startup file run by my shell when started as a non-login shell (~/.bashrc) so as to set up my account envirnoment for one of my courses.I don't know how to proceed with this. I tried doing this in my ubuntu enviroment and my system got locked after that.

View 3 Replies View Related

General :: Get UserName In Place Of UID In The Process Check?

Apr 17, 2010

I add a user in my linux machine using the command 'useradd' as shown below. # /usr/sbin/useradd -c "Non Root User" -d "/home/testUser" -g root testUser "/etc/passwd" file shows that user created with uid '517'

cat /etc/passwd
ot:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin

[code]...

View 1 Replies View Related

General :: Check A Process Which Is Over Loading The Serve?

May 12, 2011

How do I check a process which is over loading the server. I give command Top andthe average load of the server is so high.

How should I kill the over loading process.

View 5 Replies View Related

General :: Check If Process Is Running / If Not / Execute Another Script

Jul 11, 2011

I have a game server running using java, and it tends to crash sometimes, and only way to start it now is manually, so i thought i could create a script to check periodically if java is running, and if it isn't, run my startup script for the game server also, if it's possible it should log when it actually started the server startup script into a text file or something, so i can check why it crashed.

View 6 Replies View Related

General :: Start Script Bash When System Start Stop Reeboot?

Dec 10, 2009

I have 3 script BASH. I want start this script when the system start,stop and reeboot.

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved