Programming :: Running A Script When A Folder Changes?
May 20, 2010
I have a script I would like to run every time a specific folder changes. I want this to be run the instant the folder is changed every time it is changed.e found some information about inotify and it sounds like it would probably do what I want,but am unsure if it can be made to watch only a single folder rather than the whole file system, and I'm unsure of how quickly it works
View 4 Replies
ADVERTISEMENT
Mar 28, 2011
I been using linux for a while, but I havent had the time to really learn it. Something Id like to get more familiar with is bash so here is a simple example of something I would like to do:
I have a directory full of files. For each file in the directory create a new subdirectory with each files name.
I tried this:
#im already in this directory
aaa=./*
for a in $aaa
do mkdir $a
done
One of the problems is that there are spaces () and - in the filenames so I get many subfolders with names like "-" which i don't want.
I tried stuff like:
aaa=./*
for a in $aaa
do mkdir "'"$a"'"
done
This of course also did not work.
Additional I tried just creating a folder with the name of one of the files and I got this:
mkdir: cannot create directory `(audio) - R56339.EXE': File exists
Well yeah a file exsists with that name, but I want to create a folder- why is there a conflict?
Just to be clear here are the contents of this folder:
~/Desktop/LAB/Media/Drivers - (Image Deployment)/Optiplex_GX260/XP> ls
(audio) - R56339.EXE (NIC-Onboard-Intel) - R54402.EXE
(Modem-datafax-V92) - R54403.EXE OEM_Applications
[Code].....
View 1 Replies
View Related
Sep 4, 2009
Is suid disabled from running all home made bash scripts or just from running them as root or:
Who would know for sure.
I googled several combinations of Mandriva Linux how-to suid disabled setUID etc... so far all I found was "many distributions are disabling suid for security reasons" nothing specific.
View 2 Replies
View Related
Jun 1, 2010
My root Vixie cron crontab is set to perform a system snapshot via fsarchiver: 0 0 * * * fsarchiver savefs -o -A /backups/p30_root.fsa /dev/sda2 /dev/sda3 The command itself works fine, generating about a 7G snapshot of my Suse server. I then wish to rsync this to a NAS I have located in another building: 0 3 * * * rsync -av -e ssh --delete /backups/ root{at address}:/DataVolume/os_backups/
(yes, I'm rsyncing as root. I absolutely loathe it, but I got thrown into an quasi-SA position with a ridiculous to-do list and no time to do it. I'm having to make things just work and then go back and try to improve them/learn how. I couldn't make it work in a non-root way quick enough, so for now I'm having to cron rsync jobs as root because of all the differing file permissions on this samba/MySql server. I set the NAS to only accepts ssh from the server IP, and we're behind a campus firewall... It's serious trial by fire.) The crontab also has rsync commands for the samba areas, our specialized chemistry software and affiliated MySQL databases............
View 2 Replies
View Related
Jan 13, 2011
i tried stat and S_ISLNK(st.st_mode) but it always evaluates to false :/ is there anyway i can tell if a folder is a link to another folder?
View 6 Replies
View Related
Jan 28, 2010
I am new to Red Hat Linux. The other day I downloaded some files from the internet. The download manager placed them in the Filesystem "tmp" folder.
I determined that one of the files was 330 megabytes and the other were about another 76 Megabytes.
When I attempt to view the folder, I get a dialog box asking if I want to cancel the operation. The folder does not open.
I tried copying the folder to the desktop and was able to do this and only five files appeared in the folder... none of my downloads appeared there.
Question:
1.- how do I view the contents of the folder?
2.- Can I fix this problem?
I have rebooted the server several times, no change in tmp file access.
I tried to delete folder, system will not allow this. I am experiencing a small problem, "fooling" with this folder sort of wipes out the desktop - eventually it is restored after I tell the system to restart the Nautilus.
By the way I downloaded the files on another machine.
View 1 Replies
View Related
Mar 17, 2011
I cannot run executable files from my home folder. I just double click it and it doesn't do anything.
View 1 Replies
View Related
Feb 8, 2010
I am runnin CentOS 5.4 on a machine wiht 2GB of ram. of that 2GB free -m shows that 1.8 is being used. I wanted to find out what was consumign the RAM. I came across .mozilla folder in every users home directory. I am thinkning, is this machine some kind of GUI that is consuming the ram?I did ps aux | grep gnome and ps aux | grep kde but that came up with nothing.rpm -qa | grep gnome showed lots of gnome python RPM's.I am using ssh to connect to the machine and can not log in locally to see since it is at a remote location. Is there any way of finding out if a GUI is running, if so how would I uninstall it?
View 3 Replies
View Related
Dec 4, 2010
i googled around and finally stumbled over this forum. I've been wondering, how would i kill an process running from an folder and with user parameter? I usually type this into the ssh console: pkill -9 < process > -U < username >
But i want users be able to run it multiple times, and killing only an specific process and not every single one.
View 4 Replies
View Related
May 11, 2011
I'm running Android (without installing it) through VirtualBox under Ubuntu. I already added a folder of my Ubuntu system, in the shared folder settings in VirtualBox.Now the question is: how do I access this folder from inside the virtualized Android?where is it?
View 1 Replies
View Related
Jul 5, 2011
how do I increase the size of my home folder in OpenSuse11.3
View 12 Replies
View Related
Dec 1, 2010
I've been looking into libtrash to give me the ability to recover files that users mistakenly delete from Samba/Netatalk/ProFTPD shares.But I have some questions about getting a specific libtrash configuration.We have a RAID6 shared files partition and all our users have full read and write access to /mnt/raid6/shared through Samba/Netatalk/ ProFTPD...Reading through all the docs supplied with libtrash it seems to suggest that the trash folder can only be located in the user's home folder.
This has prompted a couple of questions:
1) Having gone through the docs, I can't find a place to specify the location of the trash folder.I can specify the name of the trash folder, but it seems like it's automatically created under the user's home directory.I'm looking to have the trash folder also stored on the RAID6 partition.Because the boot/OS drive is a smaller 120GB drive, and the RAID6 is 4TB. So if someone deleted 3TB of files, the trash folder wouldn't be able to take them all as the trash folder's on the 120GB boot drive.
Is there a way to specify the absolute location of the trash folder?I'd like to have a single trash folder for all users of the machine.
2) Since this is a server, most of the daemons will be running as user nobody/samba/ whatever. Not an actual interactive user account with a home folder etc.
I have read the note about this in the docs and it seems that user nobody will need write access to the trash folder in order to put files in there.However it will rarely be the case that it's an interactive user removing files from the terminal. I'm only looking for protection if any of the server daemons remove files.
Does libtrash run in the background or is it only active when an interactive user is logged in?Since it seems libtrash is activated by a variable in /etc/profile
Is libtrash suitable for what I'm looking for?Anyone got any alternate suggestions for what I'm trying to do?Is there something I could be doing on the filesystem level? The FS of the RAID 6 array is ext3 but can always change that if there's something better out there!OS is CentOS 5.5 64bit
View 1 Replies
View Related
Aug 14, 2009
I'm trying to get vsftpd running with both anonymous and local user access to the same folder. The directory I'm using is /tftp with the following permissions:
dr-srwxrwx 7 root root 12288 2009-08-14 15:54 tftp
My vsftpd.conf is this:
anonymous_enable=YES
local_enable=YES
write_enable=YES
[code]....
I set the default "ftp" user's home directory to /tftp (was /var/ftp).
View 4 Replies
View Related
May 25, 2011
im trying to run minecraft.jar which just freezes up at startup screen, wondering if i made a mistake in java along with that Firefox doesn't have a plugins folder i can find to put java into heres the files it has
application.ini libfreebl3.so libxul.so
blocklist.xml libmozalloc.so Link to firefox
chrome libmozsqlite3.so mozilla-xremote-client
[code]......
View 3 Replies
View Related
Jan 11, 2011
I want to count the number of files in each sub folder of a directory structure. At the moment I can do:
ls -1R /Folder | wc -l
Which lists the item count for all the folders as one. I can do:
ls -1R /Folder wc l
Which lists all the folders in the top level and all the items. Is there any way to get the list of folders and then item count for each folder?
View 1 Replies
View Related
Jun 8, 2010
I'm the server guy which is why I don't know this, but were staging a new webserver and we use some custom perl scripts and as were moving the site over for testing, apache is blowing a perl error;Can't locate web.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at /home/mcp/htdocs/cgi-bin/newgraph.gif line 11.,Now I can copy that file local, but there are a bunch of things, so the question is how do you globally add a folder to the perl search path
View 1 Replies
View Related
Apr 1, 2010
I work on two hosts, [1] with online ftp access, and [2] without ncftp installed, but with ssh access.
Now I need to recursively upload a folder from [2] to [1]. So I can't use hardfeed - which is for downloading
I think I can use a
find ./orig -exec curl ftp://pinshosting.net
But I'm not so so known with the params of find and curl to get it working recursively.
View 4 Replies
View Related
Dec 5, 2009
I'm using rmdir(), and everything goes ok if the directory is empty, ?how can I remove the entire tree when i have other files or directories in the folder that I want to delete?I've read about using "system(rm....)" but i REALLY want to do this without it, is it possible?
View 4 Replies
View Related
Jul 18, 2011
I am an avid user of gmail. Recently I have been receiving some important e-mails, and I want to download only those e-mails from that specific person to a folder.
View 1 Replies
View Related
Oct 9, 2010
I have a lot of pdf files and I want to convert them to a lower quality for the web. I tried to use the following command (using ghostscript): Code: gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/default -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf Is there a way to make a batch to do this for all pdf-s in a folder?
View 4 Replies
View Related
Jun 25, 2010
I'm trying to make my first c project (a simple tic tac toe console game), and I am wondering how to make a final product (copy all source code files to a distribution folder upon compilation). Should I use a bash script or should I use a makefile to make the distribution folder? I'm not terrible familiar with either; I have a basic makefile to make an executable, and that's about all I know of make.
And if I do use a bash script, how do I copy over source code files? I tried cp ./*.c and cp ./*.h, but I think the script read it literally as moving a file named ./*.c (and ./*.h), and couldn't find it.
My makefile is pretty much this:
Code:
objectFiles = main.o io.o board.o game.o
ttt : $(objectFiles)
cc -o ttt $(objectFiles)
View 2 Replies
View Related
Aug 30, 2010
how I can monitor a folder and get the name of newly created files or files that their size is changing? (in Perl or Linux shell script)
View 5 Replies
View Related
Jun 22, 2010
I am building a pipeline for image processing. I would like to be able to take the png images in a folder and pass them to clusterImage.pl once that is done I would like to then pass the outputted file to seperateObjects.pl the outputted file is of the same name but has kmeansOutput.all.matrix attached to the end. Below is what I have so far, but it is not working.
#!/bin/bash
#This script will take in an image and a matrix file.
#The output will be an image and a matrix file.
list=`ls *.png`
for i in $list
[Code].....
View 7 Replies
View Related
Feb 14, 2011
I am trying to compress a folder and the contents within, while keeping the permissions the same. I then need to check if the compress file is corrupt or not. Base on that result I need to transfer the file.
cd /home/ops/Desktop/temp
tar cvzfp backup-"$(date +%d-%b-%y)".tar.gz /home/ops/Desktop/dir1
gunzip -tl backup-"$(date +%d-%b-%y)".tar.gz
View 2 Replies
View Related
Aug 2, 2011
how to use find command to search for all the file in the particular folder?my script as below
find . -name "*" > $BASE/file
if [ `more file | wc -l` -gt 0 ]; then
echo "dp"
fi
output of my results will always include a . (dot)which I dunwan it include the dot.
View 11 Replies
View Related
Apr 23, 2010
My program need to monitor the foler to know which file under the folder is being opened/created for writing. I add the folder into watch list using inotify_add_watch, when a file -- say 'AA' -- is created, I'll get the event through read api call. But the inotify_event only have file name 'AA' and a event mask. these parameters can't help me to know how the 'AA' is created/openned. So I have to scan the /proc folder to get to know how is 'AA' created/openned. I don't think this is a efficient way, especially if there are lots of files are openned/created in a short time span.
View 3 Replies
View Related
Feb 11, 2010
This would eventually use some coding to make it afterwards in a format : in this format:
Quote:
AUTORUN.INF 99 1999.10.28 18:56.58
CLUF.TXT 19979 2000.1.27 7:17.18
DTPSTUB.EXE 24576 1999.8.4 0:15.52
EBE00.CD1 0 1999.10.28 18:57.0
EULA.INI 749 2000.1.12 7:14.56
[Code]...
View 1 Replies
View Related
Apr 27, 2011
Is it possible to simultaneously execute all perl scripts within a folder? How?
View 1 Replies
View Related
Dec 16, 2010
I have files and folders various permissions.I copied the files and folders to X server.But I forgot to copy of the permissions.Like is hereHow can restore the permissions?
View 3 Replies
View Related
Feb 1, 2011
I have a new folder in my directory, called 'newfolder'
When I create a diff file there is no mention of this new folder in it.
When I do 'svn add newfolder' it says: svn: warning: 'newfolder' is already under version control.
How do I get my newfolder to be included in my diff file so that it is included when someone else patches my file in their own directory
View 1 Replies
View Related