Visit Our UNIX and Linux User Community

how to pin files to /tmp

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to pin files to /tmp
# 1  
Old 03-28-2008
how to pin files to /tmp

Hi all,

Am currently working on editing a startup script that need me to copy a certain file from cdrom to /tmp (its a live cd am working on)and mount if from there to certain place..

Now i know that nothing can be stored in /tmp permanently ,however mechanism to load the file to /tmp on every boot is possible...
So i would like to know how it could be done.

Here is what i have tried (this editing that ive done is on the script that is necessary to boot properly, so there is no other script that i can code this line into ,in the pretext of making it work)
cp /.cdrom/<file> /tmp/

i included this into the script and try to boot ,but a regular cp command doesnt seem to be working...
However there are a few file that are already present on /tmp, if i can know how they were loaded ,i could use the same method..

please help


Last edited by wrapster; 03-28-2008 at 10:49 AM.. Reason: forgot a few issues
# 2  
Old 03-28-2008
cp ought to work, do you get any error message? Is the /.cdrom/ device available at that point (or is it a static file in the root file system)?
# 3  
Old 03-28-2008
I do get an error message but that is difficult to comprehend because,the script is written in such a way that ,after the copy is done ,it moves on to another file the does the same to it...
then make a block devices out of both the files and then mounts it accordingly from the cdrom to /usr and /opt respectively..

but with every tweak i do,i get different errors so difficult to say also...

I tried running the script in debug mode (bash -xv <script>) the script just runs fine.
but when i cut a CD out of this file and then boot frm it ,the trouble starts..

Do you have any work around for placing a script in a tmp at boot.
even a stand alone script that does the job will do, (in which case i will just call this new script from the existing one)..
can you pls think of any such script..

Help is needed urgently!!(coz am still a student studing, and doing this out of my interest Smilie

# 4  
Old 03-28-2008
Is the error message "cp: command not found"? Or "/.cdrom/: device not found"? Or "psychic help forums: you already know what the problem is"? Or what?

Different architectures have different start-up script arrangements. Ubuntu for example replaces the original /tmp/ with a virtual file system at some point during the boot process so it could be that your copy succeeds but the directory is shadowed later on in the boot process. What are you using for the CD image?
# 5  
Old 03-29-2008
I know what my error is , after the boot process begins there are a few modules that are loaded correctly after that comes this part and the error goes something like this,

lofiadm:open:/tmp/<something.zlib> :No such file or directory
"loopback device /dev/lofi/1 not created"

these are the 2 error outputs am getting..
the first one i get is because the cp /.cdrom/<something> /tmp
is not being succeeded

and the next one is actually a follow through that calls another function up the script that makes use of this cp statement to pass arguments to the functions to make a lofi file

Am using the live cd of belenix (these manipulations are to be done to this OS) and using solaris-79a for all these manipulations (to access the files of belneix and do changes then a putback)

consequently since the cp is not working the function that take the args are not working properly

Last edited by Perderabo; 03-30-2008 at 12:12 AM.. Reason: disable smilie
# 6  
Old 03-29-2008
Solaris Things: How small can you make Open Solaris - Part 1 are using gzcat to unzip something into /tmp. If you have a really small system then maybe cp is not available after all. Would still be helpful if you could post the actual error message you get from that -- the lofiadm error is apparently because you are trying to mount a file which wasn't copied because the cp didn't happen ...? Or are you really saying that cp fails completely silently?
# 7  
Old 03-29-2008
The link you've posted is something similar to what am doing, and the error message ive sent you already are the real ones..
these were the exact messages am getting when i do the changes and cut a cd out of it and boot...

Just for your reference i'll type it the procedure pls have a look

cp /.cdrom/<somehting.zlib> /tmp
make_lofi /tmp/<something.zlib> 1
if [$? -eq 0]
/usr/bin/hsfs/mount -o ro /dev/lofi/1 /usr 2>/dev/msglog
echo "unsuccessful mount ">/dev/msglog

this is what i have done so far, and its not working.The "make_lofi" thing is a function that is defined earlier in the script and "1" is taken as an agr to map the device id easily...

ive tried to change the permission of the FS from ro to rw ,didnt work.
i tried it by creating a virtual path, but to no avail...
Do you have any other work around?


Previous Thread | Next Thread
Test Your Knowledge in Computers #635
Difficulty: Medium
The iPhone 6 and 6S were available in three sizes at launch: 32, 64, and 128 GB.
True or False?

10 More Discussions You Might Find Interesting

1. Red Hat

Can all files under /tmp be safely removed

I wanted to know whether all files under /tmp can be safely removed. I guess that /tmp may also have temporary files for applications currently being worked on, so at the most those applications may just shut down. I hope that my question is clear whether all files under /tmp can be safely... (5 Replies)
Discussion started by: RHCE
5 Replies

2. UNIX for Dummies Questions & Answers

Redirecting tmp files of SORT into different directory

Hey Guys, I am facing an annoying scenario, fewer times when I execute the sort command, it throws out on error saying that "No Space on available on /var/tmp/<temp file name>. May be it is set to /var/tmp directory. I was wondering, if I cant redirect the temporary file creation to any other... (3 Replies)
Discussion started by: abhisheksunkari
3 Replies

3. AIX

Unknown files in /tmp

I have a lot of files with the following names in /etc /tmp/<num>.mktcpip like /tmp/934030.mktcpip Anyone knows which process creates these files? (1 Reply)
Discussion started by: petervg
1 Replies

4. UNIX for Dummies Questions & Answers

ls or find files under /tmp/*

what is proper syntax to ls all files under /tmp/*, and wc -c ? (4 Replies)
Discussion started by: tjmannonline
4 Replies

5. AIX

what is creating the files in /tmp

How do I find what is creating these bunch of zero byte files under /tmp directory every few minutes. AIX - 5.3 TL05 # ls -l /tmp -rw-r--r-- 1 root system 0 Nov 05 16:54 n83n7a -rw-r--r-- 1 root system 0 Nov 05 16:54 ZO3S7a -rw-r--r-- 1 root system ... (3 Replies)
Discussion started by: mbak
3 Replies

6. Solaris

How to save files in /tmp????

Hi all, I would like to know how to save files in /tmp... I was interested in knowing this because when ever i booted into solaris there would already be a few files present in /tmp.however any file that is freshly stored in would be lost on reboot... can anyone answer this pls!! (3 Replies)
Discussion started by: wrapster
3 Replies

7. AIX

set permission to files in /tmp

Trying to setup user to have the ability to delete any files (regardless of owner) in /tmp. I've tried almost everything... the permission on the folder is drwxrwxrwt 10 bin bin, and at one point I give all the possible permission (short of root) I can give to the user, and he still can't delete... (2 Replies)
Discussion started by: cchiang12
2 Replies

8. Solaris

Auto delete files in /tmp dir ???

I have a Solris 9 box my problem is when I restart my box all my files and dirs in /tmp dir will be deleted exept 2 directories I found them since installation phase !!!! How to keep my files at that dir " /tmp " even after restarting ??? (1 Reply)
Discussion started by: DarkSoul
1 Replies

9. Shell Programming and Scripting

K shell /tmp/sh$$.* files problem

Hi, I am encountring this problem from some time now... ksh creates temp files /tmp/sh$$.* . Sometimes if some of my shell script crashes or I kill it... these temp files remain in the /tmp directory. At some later time when some script gets the same PID it tries to create files in the... (5 Replies)
Discussion started by: amitkr
5 Replies

10. UNIX for Dummies Questions & Answers

monitoring /tmp and /var/tmp for suspicous activity

Hello, does anyone have a script that can check the contents of the /tmp directory and for example e-mail the directory content if anything other than session files are present? Maybe there are better ways to monitor suspicous /tmp and /var/tmp activity, if so I'm listening :) (1 Reply)
Discussion started by: jamesbond
1 Replies

Featured Tech Videos