Shift report script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shift report script
# 1  
Old 09-22-2010
Shift report script

hey guys, so i'm running into a wall here with my script. i simply can't figure out a way to get it to work. so, maybe you guys can help me.

i'm trying to created a report of server alerts based on the time worked. what i have so far is curling nagios pages, removing all the extra html tags and things and dumping them into two .csv files. from there it would parse out the timestamps in each file based on the hours worked. initially i had tried to read user input based on either the time my shift started, or the duration of the shift, but i've had no luck. anyways, here's a few issues i'm having

issue #1
there are graveyard shifts that span multiple days

issue#2
one page has PST timestamps and the other one has JST. so there's a difference in time between the two files. here's an example of what it would look like.

PST
Code:
09-21-2010 20:34:43
09-21-2010 21:35:33
09-21-2010 22:35:33
09-21-2010 23:35:33
09-22-2010 00:36:33
09-22-2010 01:37:43
09-22-2010 02:37:53

JST
Code:
09-22-2010 12:34:43
09-22-2010 13:35:33
09-22-2010 14:35:33
09-22-2010 15:35:33
09-22-2010 16:36:33
09-22-2010 17:37:43
09-22-2010 18:37:53

so as an example, if i ran my script at 03 PST and my shift started at 22. it would pull everything in the PST file from 22 up until that point, and for JST it would in turn pull everything from 14 up until the current time in JST.

sorry for making such a long and complicated post, but i've been at this for a solid week trying to figure it out and nothing i've tried works so far. so, any help is appreciated! thanks!
# 2  
Old 09-22-2010
Please post your script.
# 3  
Old 09-22-2010
well i can't really because #1 it contains information from my work that i'm not able to post, hence the reason i only included the timestamps and not the information following them. and #2. i was mostly trying to see if anyone knew theory wise how i could get around some of the issues i was having. it would help if anyone could provide example code, or code they think might work as well. lol
# 4  
Old 09-22-2010
I'm not sure I fully understand the problem. From what I do gather, I'm thinking why not take the shift info in parts. Date the shift start, time the shift started and the number of hours worked. From there you can do some date/time math to find out the date the shift ended. From there process the file with an eye for those dates.

For question #2, do your times need to be presented differently depending on who views it? If not I'm not sure I understand the problem. Do you know which files contain PST and JST ahead of time? If so, would it be worthwhile to convert the times listed into UTC time? It would require more code and more specific input from the user. (What time zone are they putting the request in for) But it solves issues when it comes to displaying data.

Again I'm not 100% sure I understand the problem, so I'm just throwing ideas out.
# 5  
Old 09-22-2010
Quote:
Originally Posted by jeff_smith
I'm not sure I fully understand the problem. From what I do gather, I'm thinking why not take the shift info in parts. Date the shift start, time the shift started and the number of hours worked. From there you can do some date/time math to find out the date the shift ended. From there process the file with an eye for those dates.

For question #2, do your times need to be presented differently depending on who views it? If not I'm not sure I understand the problem. Do you know which files contain PST and JST ahead of time? If so, would it be worthwhile to convert the times listed into UTC time? It would require more code and more specific input from the user. (What time zone are they putting the request in for) But it solves issues when it comes to displaying data.

Again I'm not 100% sure I understand the problem, so I'm just throwing ideas out.
yeah i already know which files have the JST and PST timestamps in them. but that actually would work. if i convert the time's to UTC it would make it alot easier to work with! yeah i'm sorry it's a little complicated and i'm not quite sure how to explain everything:....but your suggestion definitely should help in getting over that hurdle of timezones. lol thanks!^_^
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

Need help with a Perl Script using Pop, Shift, & Push

Hello everyone, I am new to Perl and I am having some issues getting a script to work. I have to create a script that uses an array of 52 cards, "shuffles" the cards (using loops with the pop, shift, and push commands), and prints out the top five. This is not a randomizing of the array just a... (2 Replies)
Discussion started by: Hax0rc1ph3r
2 Replies

2. UNIX for Dummies Questions & Answers

can someone explain shift command in script?

think using shift would help me finish my script but cant get it work without your help. would appreciate if you give me a example with shift & counter in the same script so I can later work on that to my one. Thanks and Good Luck! (1 Reply)
Discussion started by: me.
1 Replies

3. Shell Programming and Scripting

Use of Shift command

Hello Expert Can any one please explain what is the use of shift command in general terms: set -- $(ls -t) shift rm -Rf $* what is the use of shift command over here. Thanks a lot for your help (2 Replies)
Discussion started by: aks_1902
2 Replies

4. Shell Programming and Scripting

shell script: cannot shift error?

This is an assignment where we were supposed to create a script to get an orginal string and replace it with another. However when I run my script (change-lines), it says ./change-lines: cannot shift I do not where the problem is. help! #!/bin/sh # a shell function to print and error... (4 Replies)
Discussion started by: alis
4 Replies

5. Shell Programming and Scripting

how to shift few words of filenames at a time using shell script

Hello everybody, I have some files in directory. I want to shift 3 characters of filenames to the right at a same time. for example, I have filenames like $ls -l 01_2000.G3.input.txt 02_2000.G3.input.txt ..., ..., 04_2010.G3.input.txt I want to change the filenames like... (3 Replies)
Discussion started by: yogeshkumkar
3 Replies

6. Shell Programming and Scripting

script assistance with shift J

Hey all, I need some assistance. I'm writing a script to eject tapes from a tape library, but the library is not a queued system and can only eject 15 tapes at a time. I added paste -d : -s so that it goes through full_tapes and puts each media_id on one line separated by the :. Now I'm... (2 Replies)
Discussion started by: em23
2 Replies

7. UNIX for Dummies Questions & Answers

shift not working

Hi, I wrote one script, in between script needs to use 10th and 11th positional parameters, that time i used "shift". Here i am facing the below find problem, ./DataCount.sh: cannot shift I tried 1) I have read man pages for shift 2) Before but * and ** 3) Simple shift with out giving... (4 Replies)
Discussion started by: Nagapandi
4 Replies

8. Shell Programming and Scripting

Regarding the shift command???

I am running a program where in I have this command which is giving error the shift: number is not correct. can you please tell me how shift actually works? the line which is giving error is- set $PARAM; shift; shift; shift; shift; shift; shift; shift; shift Is it related somewhere to... (2 Replies)
Discussion started by: shrao
2 Replies

9. Shell Programming and Scripting

shift command

Hi Folks, In shell scripting the maximum no. of command line parameters becomes 9(Am i right). If we want to get more than 9 parameters we use the shift command. Even here there are two possibilities. 1. Without the use of variables - The arguments are lost and the lost no. is equal to the... (6 Replies)
Discussion started by: Nisha
6 Replies

10. UNIX for Dummies Questions & Answers

shift command

There is an error when i am trying to use the shift command in this way: ($1 = -d, $2 = 123, $3 = -c etc etc) for $arg in $@ do case $arg in "-d") shift; (so that the $2 will become the $arg now) (and while it loop the 2nd time,) ... (1 Reply)
Discussion started by: AkumaTay
1 Replies
Login or Register to Ask a Question