Using dd command to create a .sequence file
Hi Everyone, firstly like to say Hi can't say how many times I've randomly searched for something via google and got the answer on this forum... its a lot :)
I know there is a major thread on how dd works but I'm really confused by it in terms of what I'm trying to do Basically I've inherited this concept where say in a dir /var/spool/send a person runs this command dd if=/dev/zero of=.sequence bs=8 count=1 Now what I inherited is a binary c file that can lock this .sequence, print out the number 'stored', and bump up the number. Unfortunately I don't have access to the original c code source currently and considering I'm just trying to duplicate into java. e.g first time program runs it just prints out 00000000000000000000 second prints out 00000000000000000001 The idea is to create a sequencing filename mechanism. So if I was spooling a bunch of files to a web service or some sort of socket the program writing to the files would first use 00000000000000000000 as the file name then 00000000000000000001 for second ... Now I'm trying to figure out how this was done in the c program and actually do the same thing in java. I noticed something in the forum message but I'm not sure how it correlates zeus@pandion:~/tests$ hexdump .sequence 0000000 0002 0000 0000 0000 0000008 Thanks guys this is probably something so simple but... |
It seems there's a bunch of unnecessary information in this post. Can you confirm my interpretation please?
You want a java program to open a file, read an integer, increment it, write it to the file, and then display it? |
Thanks
Hi Admiral yeah pretty much. I was just trying follow the same mechanism we have today in the system. Guess it doesn't really need to rely on a dd sequence file at all when you put it like that :).
|
I know you asked for it in Java, but here it is in a bash script:
Code:
#!/bin/bash |
Thanks Admiral that is pretty much what I will use.
Jason |
All times are GMT -5. The time now is 08:17 AM. |