Sponsored Content
Operating Systems Linux Running 'sync' command frequently. Post 302875385 by Corona688 on Tuesday 19th of November 2013 11:01:08 AM
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..
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

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

10. 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
SYNC(2) 						     Linux Programmer's Manual							   SYNC(2)

NAME
sync, syncfs - commit buffer cache to disk SYNOPSIS
#include <unistd.h> void sync(void); int syncfs(int fd); Feature Test Macro Requirements for glibc (see feature_test_macros(7)): sync(): _BSD_SOURCE || _XOPEN_SOURCE >= 500 || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED syncfs(): _GNU_SOURCE DESCRIPTION
sync() causes all buffered modifications to file metadata and data to be written to the underlying file systems. syncfs() is like sync(), but synchronizes just the file system containing file referred to by the open file descriptor fd. RETURN VALUE
syncfs() returns 0 on success; on error, it returns -1 and sets errno to indicate the error. ERRORS
sync() is always successful. syncfs() can fail for at least the following reason: EBADF fd is not a valid file descriptor. VERSIONS
syncfs() first appeared in Linux 2.6.39; library support was added to glibc in version 2.14. CONFORMING TO
sync(): SVr4, 4.3BSD, POSIX.1-2001. syncfs() is Linux-specific. NOTES
Since glibc 2.2.2 the Linux prototype for sync() is as listed above, following the various standards. In libc4, libc5, and glibc up to 2.2.1 it was "int sync(void)", and sync() always returned 0. BUGS
According to the standard specification (e.g., POSIX.1-2001), sync() schedules the writes, but may return before the actual writing is done. However, since version 1.3.20 Linux does actually wait. (This still does not guarantee data integrity: modern disks have large caches.) SEE ALSO
bdflush(2), fdatasync(2), fsync(2), sync(8), update(8) COLOPHON
This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2012-05-04 SYNC(2)
All times are GMT -4. The time now is 02:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy