Ubuntu :: $(date +%k) Acts Weirdly In A Bash Script?

Jul 14, 2011

This might well be a case of "I've been looking at terminals for far too long", but here goes. In a bash script I'm writing I'd like to get the current minute of the day. Since date doesn't have an in-built format string for that, I thought I would do:minute of day = 60 * hour of day + minute of hourHowever, when the clock rolled around to 12 / 0 the value disappears from the variable. Viz:

Code:
hour=$(date +%k)
echo "hour: $hour"

[code]...

View 4 Replies


ADVERTISEMENT

Ubuntu :: Bash Command For Counting Down To A Certain Date

Jan 6, 2010

I would like to write a shell script that displays the number of days, hours and seconds left until a certain date and time. What commands would I use?

View 6 Replies View Related

Ubuntu :: Use The Date Command In A Simple Bash Script?

Oct 26, 2010

I am trying to use the date command in a simple bash script as below:

#!/bin/sh
this_date=`date`
echo "The date is $this_date"

This script seems to work only if a surround the command with the `` characters, which I copied from another script. Can anyone tell me why this is, and how I can insert these characters from my keyboard,which only has normal quote and double-quote characters?

View 5 Replies View Related

Security :: Hard Disk Memory Usage Weirdly High

Apr 2, 2010

i am having a problem that i would call a bit "important" with my server. so, from last 3 weeks the used space of my hard disk (RAID I) started growing up. i have 2 x 1 tb HDD working on RAID I and i did not install anything those weeks. the space just started changing from 90 GB till 580 GB. now the situation is stable there but i think it's not normal.

the bandwidth usage is low (like 120 gb in 2 months) and i am running 6 counter strike gameservers, a forum, a very little website and some local stuffs... a friend of mine told me that my server could have been hacked but i am afraid it did... some useful informations: when i reboot the server the used space goes down again to ~100 GB and then it starts going up again. i cant really find where all those files are located:

[Code]...

View 2 Replies View Related

Debian Programming :: Yesterday Date In Bash Script

Jun 22, 2011

I have used "FILENAME="`TZ=$TZ+24 date +%y%m%d`" in a bash script that run in openbsd. What my script does is to changes a file name to "yesterdays date". I tried to use it in a script that runs in debian but it doesnt work. Is there any other command that i can use in debian?

View 3 Replies View Related

General :: Bash - Create Folders According To Date In System?

May 26, 2011

Is there any other short/easier and smarter way to do the following in Linux? code...

I need to use crontab to create folders every day and every month inside /home/abcd/dammi, /home/abcd/harrami, /home/wxyz/dammi and /home/wxyz/harrami. Can anyone help me with this?

View 2 Replies View Related

Programming :: Bash Scripting With File Date Comparison?

Mar 23, 2011

I need to be able to compare a file date with system date and delete files older than 30 days.

the file name is basically
error_log.03222011

of course the extension is the date the file was created.

Oh and before i get hammered I looked everywhere but am unable to make sense of what I found.

View 3 Replies View Related

Programming :: Converting YYYYMMDD To Date In Bash Script?

Aug 2, 2010

I need to convert strings in the format YYYYMMDD to dates so I can perform date arithmetic.

View 4 Replies View Related

Programming :: Manipulating A Date In A Perl Bash Script?

Mar 11, 2010

I've recently inherited a bunch of files at a new job and am trying to figure out some of the problems that have constantly popped up. The one i'm getting a huge headache with results from a bash script that is supposed to change a date format from a client populated txt field to one we want defined a certain way. Everything in the script works fine, except that one function. Below is the line i'm trying to manipulate, with date examples.

sed -e 's/.0000 EA/ EA/' -e 's/ 01012010 / 01-JAN-2010 /' -e 's/ 12312011 / 31-DEC-2011 /'

The one caveat is that the first date is non-static and changes daily. It is, however, always the current date. If it helps, the second date will always be a year away from the first date.My idea was to pull the current date via perl's DATE function, but...how to do it, and calculate a year away without throwing the rest of the bash script off? Any help would be appreciated. I'm sure it's a simple solution but i know absolutely nothing about these scripts and how they were written.

View 10 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

General :: BASH To Find Pics And Videos With No Date Taken Exit

Aug 7, 2011

Is there a script to do this? I have shotwell and want to find files that are going to cause problems with automatic sorting.

View 3 Replies View Related

Programming :: Bash Script To Copy Modification Date From A File To His Folder?

Jul 29, 2011

I need this script but I don't know how to do it I have one folder with several folders inside.On each folder a have one MKV or AVI file inside...What I need is a script to change the "modification date" of each folder to the "modification date" of each MKV or AVI that the folder has inside.

View 16 Replies View Related

Ubuntu :: Compiz Acts Strange After Reboot?

Sep 6, 2010

Pretty sure it's Compiz, as when it's acting up if I try something simple like switch workspace, things lock up. A gdm restart can recover from that condition.So after a reboot, log in and start something benign like Firefox (doesn't matter what you start). The window will 'paint' from the bottom up over a period of a few hundred milliseconds. A significant fraction of a second, though. All window operations have this delay.A small window near the top of the screen exhibits a delay as if the entire screen below it had to 'repaint' before it can be displayed.

If you then lock the screen and return to the same session, everything seems to work as normal.lternatively, you can log in as another user... same effect there... return to session 1 and everything is normal. Return to session 2 and everything is normal.It seems that returning to gdm's login screen and back fixes it.So just when you log in for the first time, this annoying paint issue appears.As mentioned, if you try to use any sort of compiz effect, that session is frozen.Usually, things are ok - even if you log out and back in - until the next reboot.

When this first started happening, I would log out/back in and the effect would sometimes fix itself. But not always. The key difference between that and the 100% fix above is that you don't log out above. The session remains logged in. Also, I tried switching to a console and restarting gdm. That also works sometimes, but not always. I would also try starting Nvidia X Server Settings tool before logging out and it seemed like that increased the chances of success. But I'm not sure it did. It does seem that once it's fixed, it stays fixed until the next reboot.Sorry for the lengthy post, but I warned you I wasn't sure how to describe it. Some general things about my system; more gladly on request:- AMD Athlon(tm) 64 X2 Dual Core Processor 4800+- 2.6.32-24-generic #42-Ubuntu SMP Fri Aug 20 14:21:58 UTC 2010 x86_64 GNU/Linux- 00:05.0 VGA compatible controller: nVidia Corporation C51PV [GeForce 6150] (rev a2)Package: compiz-gnome
State: installedAutomatically installed: noVersion: 1:0.8.4-0ubuntu15

View 2 Replies View Related

Ubuntu :: Audio Acts Strange After Standby(skips, Repeats)?

Jun 6, 2010

for some reason after I standby, my sound doesn't work as it should. It skips and sometimes repeats and then catches up to where it's supposed to be. I think video does this too

View 1 Replies View Related

Fedora :: F11 Udev Acts Completely Broken?

Aug 10, 2009

/etc/udev/rules.d/20-our.rules has worked perfectly in FC6 and F10. In F11 I can't get udev to even look at it, much less execute the udev commands in it. Stat tells me that none of the relevant files have been accessed when I plug in a USB device that udevadm says was processed and which clearly matched the rules.. I reboot with several USB devices plugged in and according to stat nothing anywhere in /etc/udev was accessed during the boot process.

View 11 Replies View Related

Programming :: Daemon Process Design Which Acts As A Tcp Proxy Server?

Mar 8, 2010

know abt daemon process and how it is used for acting as proxy server if nay tutorial is there for it .

View 3 Replies View Related

Ubuntu Multimedia :: Replace Jpg Files Last Modification Date With Timestamp Creation Date?

Sep 22, 2010

I'm looking for a method for modifying some jpg photo files last modification date with the corresponding timestamp creation date of each file.The reason is that shotwell import pictures in folders according to last modification date which is stupid on my opinion.

View 2 Replies View Related

Ubuntu :: Organize Folder With Images By Date Taken Rather Than Date Edited?

Aug 1, 2011

As a photographer I'm constantly taking photos and storing them in folders. Now occasionally I'm using two cameras (either for different settings or an assistant is also taking photos) which means that for one event I can have differently named images.Both cameras have the same time set (which always helps in Windows) but in Ubuntu when trying to sort my folder by date taken I can't.The options I'm given are to sort them: Manually, by Name, by Size, by Type, by Modification date and by Emblem.Now none of those are helpful to me once I've done a few edits to the images.So please if anyone knows, how do you organise a folder with images taken on different cameras by Date Taken rather than Date Edited?

View 3 Replies View Related

General :: Use Date With Touch To Create New File With Date Based Name?

Mar 12, 2010

I am using CRON to create a new, blank file, every minute, in a specific location on my web server. After web searching, and reading man pages, I get the impression that the following command is supposed to work:touch /home/mydomain/var/folder/attachments/`date +%H%M`.txtThis should give me a new file with a file name that is the current hour and minute.However, when executed, the CRON mailer reports:touch /home/mydomain/var/folder/attachments/`date +/bin/sh: -c: line 0: unexpected EOF while looking for matching /bin/sh: -c: line 1: syntax error: unexpected end of fileSo, it looks like shell is seeing the plus (+) sign as an EOFObviously, nothing get created.What would be the easiest, single line command to create an empty file, at a given location, with a time based file name

View 5 Replies View Related

General :: Julian Date Converter To Gregorian Date

Apr 22, 2010

Anyone have a ksh solution to convert julian date to gregorian date?

View 6 Replies View Related

Hardware :: Single Mouse Click Acts As A Double Click

Aug 18, 2010

Code:
linux-uitj:/home/anisha # uname -a && cat /etc/*release
Linux linux-uitj 2.6.31.5-0.1-desktop #1 SMP PREEMPT 2009-10-26 15:49:03 +0100 x86_64 x86_64 x86_64 GNU/Linux
openSUSE 11.2 (x86_64)
VERSION = 11.2

If I normally click the Trash icon either in Kmail or in Evolution more than one mail gets deleted in a sequential order! I have to press the click button extremely light to avoid this problem. I have confirmed this problem is not only with the Email clients but even with most other normal applications too. I have changed my mouse twice but the problem persists. Both were USB mice. Below I have provided log information :

Code:
linux-uitj:/home/anisha # dmesg | grep usb
[ 0.138267] usbcore: registered new interface driver usbfs
[ 0.138267] usbcore: registered new interface driver hub
[ 0.138267] usbcore: registered new device driver usb
[ 0.396952] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[ 0.396956] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 0.396958] usb usb1: Product: EHCI Host Controller
[Code]....

View 9 Replies View Related

Ubuntu Multimedia :: Digikam - Renaming On Import - "Create Date" Versus "File Modification Date"

Jan 24, 2011

I just switched from a basic digital camera to a more advanced one that stores both Jpeg and Raw (.Nef - it's a Nikon) files for me.When importing files in Digikam, I rename the files so that they start with Date and Time. Example: 20110121-223748.JPG for a photo taken on Jan 21st 2011 at 22:37:48.I was a bit surprised when importing both the JPEG and the Raw version of the same photo, that the filename is different by a few seconds (no constant offset, sometimes they are the same):

20110121-223748.JPG
20110121-223750.NEF

I did some "research" by looking at the exif data of both files (using "exiftool 20110121-223748.JPG" from the command line). Here is what I got back

(amongst other data):20110121-223748.JPG
File Modification Date/Time : 2011:01:21 22:37:48+01:00
Modify Date : 2011:01:21 22:37:48
Date/Time Original : 2011:01:21 22:37:48

[code]....

So it seems that Digikam is using the "File Modification Date/Time" (different in the Jpeg's and Raw's of my camera) rather than the "Create Date" (the same for both Jpeg and Raw). (The few seconds difference in "File Modification Date/Time" between the two versions of the same photo is probably due to the time that my camera needs to write away the data on the SD memory card. I guess.) Is there a way to have Digikam use the Create Date? (Or the Date/Time Original?)

PS: I'm on Ubuntu 10.04LTS, using DigiKam 1.2.0

View 1 Replies View Related

Programming :: Keep Original Mod Date Of A File And 'date' It Back To Same File?

Jul 12, 2010

I would really like to preserve a file's original modified date and pass it back to the file as the same attribute after a script has worked on it. I get a lot of JPEG files from different places on the Net which I either turn around and upload or burn to disk, and having the "original" date of either download or last mod in a graphics app would be for me, in the long run, a lot more helpful when deciding, for instance, which files to "recycle" or pass on backing up more than once.I've tried doing this on my own every now and then. Where I run into problems is that it appears "stat" and "date" use different formats for date information, and I can't seem to puzzle out how to "translate" one to the other satisfactorily for the latter command.

Just to give an example:
stat foo.jpg |grep Modify gives me
Modify: 2010-07-12 06:28:56.890625000 -0400

Passing that string as-is to date foo.jpg, I get the errordate: unknown option -- 0 and the usual semi-courteous suggestion to Try 'date --help' for more information.Somehow my TexInfo database got screwed up somewhere along the line and info dategives me the short article on date input formats, not the full documentation for the command

View 4 Replies View Related

Ubuntu :: Find Out The Last "up-to-date" Date For "Update Manager"?

Jul 31, 2010

When I clall the "update manager" it tells me if my system is up-to-date or new updates are available. Lets assume I update my system now (I disabled automatic updates).

Then (in a couple of days or weeks) I start the Update Manager again and it tells me again that new updates available. How can I find out now when the last time was when my system was "up-to-date" (=when a complete, successful update took place)?

Is there soemwhere an entry which shows this date?

View 1 Replies View Related

Ubuntu :: Terminal Bash / -bash: Ls: Command Not Found

Jun 5, 2011

I got a problem with terminal, since i'm really a noob with terminal i don't know how to fix it.Everytime i type in a command it shows for example:

-bash: ls: command not found

Even the basic commands don't work... just cd <directory> and those things works

View 9 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

General :: Write A Literal Bash Command In A Bash File?

Nov 29, 2010

I create a bash script that writes another bash file. But in the generated bash file I want to write a bash command in the file and not executing it.Here's my bash file:

Code:
#!/bin/bash
cat > ~/generateGridmix2data.sh << END

[code]...

View 6 Replies View Related

General :: Running Bash But Common Bash Commands Not Working?

Jul 17, 2010

below are the details of my system. I have bash as my current shell, some really common commands aren't working.

Do I need to do a re-installation of bash? Or how do I install a selection of bash commands which I need? (for example a subset of [URL])

Code:
root@sdptfw:~ # uname -a
Linux sdptfw.sdpt.co.za 2.4.36 #1 Tue Jul 22 13:13:24 GMT 2008 i686 i686 i386 GNU/Linux
root@sdptfw:~ # echo $SHELL$
/bin/bash$

[Code]....

View 13 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







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