I have a requirement where date and timestamp of a server has to be changed frequently to desired value and associated processes (Weblogic server/Java Virtual Machine Process and a script) have to have updated date and time. This is to be done so that the weblogic servers & script runs with updated date without the need to restart the process.

A feasible timestamp changer would be libfaketime but can anything be done to change time by a offset for all process or set of PIDs.

The goal is to have processes running while date is changed by an offset(number of days) for the running process without having to kill the PID. Utilities are fine if it takes less time than manual date change and killing the process.

closed as unclear what you're asking by Basile Starynkevitch, Jeff Schaller, Kusalananda, Timothy Martin, DopeGhoti Mar 9 '18 at 18:45

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Brings to mind unix.stackexchange.com/a/419375/117549 – Jeff Schaller Mar 9 '18 at 16:03
  • 1
    Wrong requirement. You are abusing the system. And you don't define what timestamp you need to change (is it of the /proc/1234/ directory for a process of pid 1234)? What executable? So edit the question to improve and motivate it much more. – Basile Starynkevitch Mar 9 '18 at 16:20
  • @JeffSchaller It's more of avoiding to reboot in [the question](unix.stackexchange.com/a/419375/117549) . Mine is avoiding to kill PID and restarting process. – Dexter Mar 9 '18 at 16:23
  • Even with the edit, the question is unclear. Please give a lot more details: what actual application, in what domain, why do you need that, etc. Avoid commenting your own question (but edit it by adding several paragraphs). – Basile Starynkevitch Mar 9 '18 at 16:30
  • 1
    Smell awefully bad as some XY problem. Without improvement it is a nauseous and meaningless question. – Basile Starynkevitch Mar 9 '18 at 16:49

I have a requirement where date and timestamp of a server has to be changed every day

This is ambiguous (and is a very bad design, since you are abusing the system). What actual file's metadata do you need to change? On what filesystem? Is it about /proc/1234/ directory (if your process has pid 1234)? See proc(5).

(what if your server was on a read-only file system, e.g. some CDROM?)

BTW, you don't define what "updating a process" would mean. Even with a lot of imagination, I can't guess what you want.

Also, why is that needed? Why can't you change some other date & timestamp (of some data file, or even a row in a database) and check that? How do you detect the case when your "server executable" is on some weird filesystem which does not allow that, or has no valid mtime? Looks like some XY problem.

The goal is to have processes running while date is changed by an offset(number of days) for the running process.

I would then code a "shell-like" process (preferably in C or in some other language - Go, Ocaml, Rust, C++, Python, etc... - give access to the entire POSIX API, and at least to all system calls listed in syscalls(2), see also intro(2) and read some Unix programming book, at least ALP or something younger). That "shell-like" stuff would monitor, and kill, the actual server.

Notice also that most Java implementations are sort-of interpreted (by the JVM), in the sense that all such Java processes are running the same JVM executable, probably some /usr/bin/java

  • 1
    I believe that what's being asked or is to run a process or a set of processes with an alternate system time. It is not clear exactly what "timestamp" means here. It may mean just another timezone ro an actual different time. – Kusalananda Mar 9 '18 at 16:35
  • 1
    We at least agree that the OP's question is barely understandable, and reveals a lot of confusion – Basile Starynkevitch Mar 9 '18 at 16:40

Not the answer you're looking for? Browse other questions tagged or ask your own question.