Programming :: Bash - MD5 Checks With Script ?

Aug 10, 2010

I'm triyng to make a Bash Script that checks (recursively) the MD5 from all the files in a certain directory and compare them against some other check that should be already done and saved in a file.

I've reached to the point where i have the MD5 from the file and the MD5 that the script saved in a file the last time it runs.

But, for some reason, when i compare them, the script always tell me that the MD5 change!

Here is the part of the script that make the comparision:

Code:

For those who want it, the complete script: (Long and with Comments in Spanish!)

Code:

View 5 Replies


ADVERTISEMENT

Programming :: Check The Db For Some Value And Run Some Functions To Do Some Checks?

May 15, 2011

have an application where from time to time I need to check the db for some value and run some functions to do some checks. is the best option do it as php daemon or cron job?Whatworried of cron job is the overalapping.

View 9 Replies View Related

Programming :: Make A Script That Checks Input Letters / Numbers?

May 19, 2010

I would like to know how to make a script that can check that i input 3 letters and 3 numbers in some field.

i am completely noob in this programming scene, but think its quite interesting.

View 13 Replies View Related

Programming :: Line That Checks If Dir "TEST" Exists. If So, Nothing, Of Not Mkdir?

Aug 25, 2010

I have a line of code from a csh script:Code:if ( ! -e TEST ) mkdir TESTit checks if the directory "TEST" exists and if it DOES exist then nothing happens, if it DOES NOT exist then directory TEST will be made. Now I want to use this in a sh (or bash) script. Does anybody know the equivalent of the line above for sh?

View 5 Replies View Related

Programming :: Bash: Printing The Line Number In Bash Script?

Feb 4, 2011

I would like to know how do I print the line # in a script. My requirement is, I have a script which is about ~5000 lines long. If there are any errors happen I just exit. And I would like to add the line # of the script where the error happened.

View 3 Replies View Related

Programming :: Bash Ctrl+c Tarp And Bash Read With Timeout?

Jan 24, 2010

simple bash code:

Code:
#!/bin/bash
trap "echo 'you got me'" SIGINT SIGTERM # to trap ctrl+c
echo "Press ctrl+c during 5 sec loop"
for ((i=0;i<5;i++)); do

[Code]...

How come code behaves normally and stops when ctrl+c signal is caught and resumes, but after I use at least one timeout read in the code it looks like, if signal is caught again it doesn't pause the execution but skips the loop. If you remove -t (timeout) option from the read, both loops look the same!

View 10 Replies View Related

Programming :: Reading A Bash Variable In Bash Scripting ?

Nov 26, 2008

I have a config file that contains:

my.config:

Code:

Now in my bash script, I want to get the output /home/user instead of $HOME once read. So far, I have managed to get the $HOME variable but I can't get it to echo the variable. All I get is the output $HOME.

Here is my parse_cmd script:

Code:

View 3 Replies View Related

Programming :: Run Multiple Bash And Php Scripts From A Bash Script?

Jul 25, 2011

I have written quite a few separate bash & scripts and php scripts that up to now I have run from cron jobs. However I have to estimate how long each takes to run, before running the next and so it probably takes much longer than necessary to run them all. They have to run in order.

Now there are so many I am thinking it would be better to have a master bash script that would run one after the other, but I am not sure how to get the master script to wait before starting to run the next script. Is this possible and is there a command that will make the script wait between bash and php scripts , for them to finish, before running the next?

View 5 Replies View Related

Programming :: Bash: Get Filename And Extension Using Bash?

Jan 9, 2010

I would like to get the filename (without extension) and the extension separately. The best solution I found so far is:

Let FILE="thefilenameofsomefilesfor_instance.txt"

Code:

NAME=`echo "$FILE" | cut -d'.' -f1`
EXTENSION=`echo "$FILE" | cut -d'.' -f2`

I think it would be better to count the len and remove 3 chars to right to get the extension, but it can be macintosh filenames with have 4 chars for extensions.

View 5 Replies View Related

Programming :: Bash Programming - Rename Files In A Loop?

Mar 31, 2011

I need to rename the resulted searched files from a loopI have the following code:

find . -name DOC* | while read i
do
find $i -type f -name '*.txt'
done

basically, I am searching for all txt files inside any folder starting with DOC name.this code is working fine with me.I need to rename those .txt files to .txtOLDOS: Ubuntu 10.4Bash shell

View 10 Replies View Related

Programming :: Write A Bash Script That Sources Another Bash Script?

Jan 29, 2011

I am trying to write a bash script that sources another bash script. Essentially, I need a few lines to check to see if a certain variable is set. If not, I set it manually, and then source a scripts with that variable in the path. I wrote a test script to try it, but for some reason the last line does not work. Here is what I wrote:

#!/bin/sh
source ~setupdir/setup.shrc #just a test, this line works
echo ${#SETUP} # prints 0 if setup is not set, which it isn't
if [ ${#SETUP} -eq 0 ]
then
SETUP="~setupdir"
fi
echo $SETUP # prints ~setupdir

[Code]...

View 5 Replies View Related

Programming :: Bash Scripting To Programming?

Jul 13, 2011

i'm in the process of learing C++. currently i'm creating shell scripts to get things done. i'm just curious how, as a programmer using C++ you would get a similar job done.as an example i have a script that takes the contents of files, pipes it to some sed and awk commands, which is piped to create a new file. that file is then imported into a mysql database.if you were going to do this in C++, would you call the sed/awk programs to modify the file, or can it be done within the program itself? i'm probably jumping the gun here because i've just started learing about pointers so this is above my ability

View 12 Replies View Related

Fedora Installation :: 10 - Checks DVD Ok But Can't See It After

Jul 21, 2009

I downloaded the Fedora 10 DVD installation image and burn it to a DVD.The image was good, I checked the md5 sum.When I put the DVD in the drive and rebooted the text based menu appeared and I chose Install or upgrade.The the installer asked me if I want to check the DVD and I entered Yes.The DVD was checked and it turned out to be fine, but after that when I wanted to continue whit the installation the installer reinserted the DVD but it gave a message saying that it can't find Fedora on any drive .Even if just minutes ago it verified the DVD for integrity.And then it ejected the DVD.If I wanted to press F12 to continue it reinserted the DVD and gave the same message.So I can't continue my installation.

The DVD was fine as you can see, checked by me and by the installer itself.Is the installer asking for a CD?? I thought the DVD was for installing.And even better, that DVD was made whit the exact DVD writer which I use for the installation.So it can't be any incompatibility problem between different DVD ROMs or Writers.

The DVD installation is very important to me, because on that computer there is no internet connection.So the DVD is a solution to install a lot of software and actually use that computer, since yum does not work.

View 1 Replies View Related

Slackware :: Password Checks - Does Not Use PAM ?

Jul 20, 2010

Since Slackware does not use PAM where do I go to set password requirements. For instance, in CentOS there is the /etc/pam.d/system-auth-ac file where I can edit the cracklib and pam_unix modules to allow/disallow dictionary checks and min/max password lengths. Where do I go to edit that in Slackware?

View 1 Replies View Related

Fedora :: 11 And Filesystem Checks - Fsck

Oct 28, 2009

I'm used to having my computer do a fsck every 30 boots or so...Fedora doesn't seem to do that...am I missing something?

View 5 Replies View Related

Ubuntu :: 10.4 Checks Disks After Every Boot?

May 15, 2010

Ever since my upgrade from 9.10 to 10.4, every time I reboot the system it does a full disk check. /var/log/boot.log tells me that fsck thinks that the file systems contain errors or that it wasn't cleanly unmounted. And yet, it doesn't seem to actually find errors, and a clean reboot starts another check (again with it thinking something is dirty). I dual-boot with Windows, and reboot from there with the same problem.Again, all of this is new with 10.4 and was not happening with 9.10.Is there a way to find out when/how/why the disks are not being unmounted cleanly?

View 4 Replies View Related

Ubuntu :: System Freeze - What Checks To Do?

Mar 26, 2011

Nothing too major here but today I had a few programs open and was doing a bunch of things and suddenly the system froze.

I am on 10.04 LTS -

Are there checks that I can do to see if everything is ok?

I had to turn the power off and re-booted and everything is fine, or rather, seems to be 100% fine - but more out of curiosity Id like to see if there are some checks that I can do.

I think that ubuntu creates a log of activity if I am not mistaken?

View 4 Replies View Related

Ubuntu :: Always Checks Discs For Errors ?

Apr 12, 2011

I was just wondering why Ubuntu is always checking my discs for errors. This happens every few times i turn the computer off and back on. Maybe every 2 or 3 times. Is this just ubuntu checking the discs or something to worry about?

View 3 Replies View Related

General :: Help On A Script That Checks Mysql Db

Mar 3, 2010

I recently got stocked with this script..it was running fine on an amazon ec2 box (centos based) but when i moved to the actual box...

Code:

Part of the mysql query is not getting the falue.

As you see; i've added echo $VALUE somewhere to verify if the value was picked up... and it is; but dbexist is null..

If i remove the single quote marks i have

Code:

Where 3816253 is the value of $VALUE...

View 14 Replies View Related

Server :: Sendmail Sometimes Does No Dnsbl Checks

Apr 2, 2010

I am running Sendmail server for SMTP. I included dnsbl form spam filtering and it works well.

Quote:

But sometimes it seems that sendmail just doesn't check the dnsbl. I was capturing the communication and I find out that several times the client just send the message and the sendmail does not even send a packet for check it in dnsbl. The whole SMTP session was completed without one blacklist check?

I use FEATURE(`delay_checks')dnl for allowing authenticated clients to pass the filters. Can this cause that the SMTP session is completed to fast and sendmail just has no time to check the dnsbls? (the check is delayed)

View 3 Replies View Related

Programming :: Sed A Variable In Bash?

Mar 25, 2011

I have beat this enough and don't get what should have been a very simple thing to do. I build a variable;

Code:
CLIST=java,lua,python,php,perl,ruby,tcl
CLIST will be used by another bash script but I need to replace the commas with a space. I

[code]...

View 2 Replies View Related

Programming :: Bash Script HELP - Hex To Dec ?

Dec 4, 2010

Creating script that converts hex to dec. But without using bc calculator or other methods that could convert it in one line. I need to make something like this script that converts dec to hex.

View 1 Replies View Related

Programming :: Can Use Bash Within An Awk Script

Apr 14, 2011

I have a basic awk script that can read a file named 'server_info' and output to the screen which fax lines are not working. Now I want to make the script execute commands instead of printing to the screen but I am having trouble... This is better explained by my code below:

test.sh Code: #!/usr/bin/awk -f
#
#The name of this script is test.sh

[code]....

View 1 Replies View Related

Programming :: Bash Command From PHP?

Jul 14, 2011

Distro: Centos 5, PHP 5I have done a bit research on running bash commands from php and there was little success. This is my relevant php script

<?php
echo exec('pwd');
?>

[code]...

View 16 Replies View Related

Programming :: Bash Function Using If / Then And Else

May 2, 2011

I am trying to build a function inside a script.

Code:
#!/bin/sh
#System commands and other configurable.
IPT=/sbin/iptables
IP6T=/sbin/ip6tables
IPST=/usr/sbin/ipset
MODP=/sbin/modprobe
GET=/usr/bin/wget
INT_NET=192.168.1.0/24 .....

I can find lots of tutorials in how to use if, then, else. However, how do I define a variable inside the function?
SEE>>
Code:
for c in $ISO
Also, am I using the 'test' command correctly( -/+ week as valid test)?

View 7 Replies View Related

Programming :: Bash IF Using IP Subnets?

Feb 14, 2011

I'm somewhere between Novice and I have no idea what I'm doing with bash scripts. I'm writing a script to deploy images using partimage on my company's desktops, and while I have just about everything else figured out I have one issue left.Each of our 4 sites that will be using this disc will have a deployment server due to the fact that our sites have dedicated point to point links that our business traffic is conducted on. I need to be able to determine what site I'm at based onubnet and set a variable based on this determination. What I don't know is how to get the IP address in to an if statement, and properly determine subnet. For example:

192.168.1.0/16 - 192.168.7.0/16 need to use DEPLSERV01
192.168.8.0/16 - 192.168.16.0/16 use DEPLSERV02
192.168.17.0/16 - 192.168.24.0/16 use DEPLSERV03

View 1 Replies View Related

Programming :: Difference Between /bin/bash And /bin/sh?

Dec 27, 2008

I know it's a very silly question but could someone please explain the difference between "/bin/bash" & "/bin/sh" I was under the impression that both are same but following output on my Ubuntu 8.10 is making me raise my eyebrows.

Quote:

parag@station3:~$ ls -l /bin/bash ; ls -l /bin/sh
-rwxr-xr-x 1 root root 725136 2008-05-13 00:18 /bin/bash
lrwxrwxrwx 1 root root 4 2008-12-03 21:42 /bin/sh -> dash
parag@station3:~$

View 11 Replies View Related

Programming :: Run Bash Script On Web?

Apr 9, 2010

i want to run bash script on website.i still have to choose between unix hosting and windows hosting. my web hosting service offer Own Cgi - Bin PHP,ASP,MYSQL,MSSQL, and script schedule(cronejob). This is script

#!/bin/bash
#Store arguments from bash command line
fight=$1
support=$2
msg=rmsg

[Code]....

View 2 Replies View Related

Programming :: Using Eval In Bash?

Nov 23, 2010

Having a problem with an unwanted redirection in in a function call. Although this isn't the function it does illustrate the problem:

Code:
#!/bin/bash
doat () {
ALL="sys1 sys2"
for Sys in $ALL;do
echo "---> $Sys <---";
echo $(eval echo $1);

[Code]...

figure out how to get the variable into the command without outputting to the file in the eval statement? So that ssh line that gets executed would look like the following to each iteration of the for loop:

Code:
ssh root@$Sys rpm -qa|sort > /trans/${Sys}-rpm-list.txt;
doat works when the incoming argument doesn't have any redirection in the command.

View 3 Replies View Related

Programming :: Using Gambas With Bash?

Jun 8, 2010

Is it possible to use Gambas as a GUI to read text string variables that are input by a user, and use the variables in a bash command?

I know how to do this simply with bash, but I want a GUI that little kids can easily use.

View 2 Replies View Related







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