Running 'sync' command frequently.


 
Thread Tools Search this Thread
Operating Systems Linux Running 'sync' command frequently.
# 1  
Old 11-19-2013
Running 'sync' command frequently.

I have a Linux server that runs a Java based app that automates file transfers for a large number of users/systems. I'm running into a problem with the scripts for this automation program in that when I have a function in the script generate an output file, and the next line requires that file to be present; the script will fail because the file hasn't made it to disk yet. I've figured out some workarounds for this problem. I can either enter a sleep/delay command to delay the whole script for a few seconds giving the system/java a few seconds to write the file to disk; or I can run a sync command that will immediately write the file to disk.

My question is, could there be any undesired side affects to running the 'sync' command so often on a system?
# 2  
Old 11-19-2013
Quote:
Originally Posted by acascianelli
I have a Linux server that runs a Java based app that automates file transfers for a large number of users/systems. I'm running into a problem with the scripts for this automation program in that when I have a function in the script generate an output file, and the next line requires that file to be present; the script will fail because the file hasn't made it to disk yet.
sync is irrelevant -- a file in cache is as good as a file on disk as far as programs are concerned. The file must really be missing, even from cache, a sync won't force it to appear. It's the wait that does the trick either way.

Both sync and short delays are liable to fail I think -- particularly when the system is busy and longer delays might happen. Either correct the java program so it doesn't return until the file actually exists, or poll for the file's existence every so often.

Quote:
My question is, could there be any undesired side affects to running the 'sync' command so often on a system?
Reduced disk performance since its busy doing more writes all the time. It may end up writing more than it would have otherwise, too.

Last edited by Corona688; 11-19-2013 at 12:24 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Another one line command where I'd like to determine if Ubuntu or Red Hat when running command

Hello Forum, I'm making very good progress on my report thanks to the very helpful people on this forum. I've been able to successfully create my report for my Red Hat servers. But I do have a few ubuntu servers in the mix and I'd like to capture some data from them when an ssh connection is... (8 Replies)
Discussion started by: greavette
8 Replies

2. AIX

I'm facing problem with rpm command, when running the command and appears this error:

exec(): 0509-036 Cannot load program /usr/opt/freeware/bin/rpm because of the following errors: 0509-022 Cannot load module /opt/freeware/lib/libintl.a(libintl.so.1). 0509-150 Dependent module /opt/freeware/lib/libiconv.a(shr4.o) could not be loaded. 0509-152 Member... (4 Replies)
Discussion started by: Ohmkar
4 Replies

3. Shell Programming and Scripting

Command to check only Autosys running jobs with autorep like command

Hi, Is there any specific command to use to check only say Running jobs via autorep or similar command for Autosys? (0 Replies)
Discussion started by: sidnow
0 Replies

4. Linux

/var getting fill frequently

I have Red hat Linux server. There are 14 NFS shares which are coming from NAS. There are so many messages filling /var/log/messages, which seems like some NFS logging is enables somewhere, but I am not able to figure it out. Every few minutes, it will filll my /var (which is part of root) to 100%... (2 Replies)
Discussion started by: solaris_1977
2 Replies

5. UNIX for Dummies Questions & Answers

Running set options from the command line and bash command

I'm reading about debugging aids in bash and have come across the set command. It says in my little book that an addition to typing set you can also use them "on the command line when running a script..." and it lists this in a small table: set -o option Command Line... (5 Replies)
Discussion started by: Straitsfan
5 Replies

6. Solaris

Server Rebooting frequently

Deall All, I have facing some problem. I have a Sun 4500 Server at the customer place. Now the server is not booting mean's once the server is coming up it is automatically rebooting. As this is the critical server for the customer that is use for production . Can this be solved by... (10 Replies)
Discussion started by: sudhansu
10 Replies

7. Solaris

Sync to Green vs. Separate Sync

Hi all....I have a Sun Ultra2 that I want to use with my PC monitor. I have purchased an adapter that does not work and I was told I need to change my video card setting (if I can) to Separate Sync.....my Monitor product number ends in 1343......I am running SunOS 5.7 ......anyone have any ideas? ... (0 Replies)
Discussion started by: psantinello
0 Replies

8. SuSE

inconsistent ls command display at the command prompt & running as a cron job

Sir, I using the following commands in a file (part of a bigger script): #!/bin/bash cd /opt/oracle/bin ls -lt | tail -1 | awk '{print $6}' >> /tmp/ramb.out If I run this from the command prompt the result is: 2007-05-16 if I run it as a cron job then... (5 Replies)
Discussion started by: rajranibl
5 Replies

9. What is on Your Mind?

why i havent been posting so frequently...

to start, i will continue to be an active member of this community and still love computers and unix based operating systems. ive been busy recently with a pretty big project, not involving unix :p one of my other hobbies is automobiles. i have a 1986.5 toyota supra, now if anyone here has... (8 Replies)
Discussion started by: norsk hedensk
8 Replies

10. UNIX for Dummies Questions & Answers

Frequently used command in UNIX

Dear Frenz, Is there any possbility to get the list of previous commands that i executed in SCO-Unix and reexecute them as required. Like Doskey in DOS Please help me Regards myuser (3 Replies)
Discussion started by: myuser
3 Replies
Login or Register to Ask a Question