Linux:如何设置进程的时区? [英] Linux: how to set up a timezone of a process?

查看:180
本文介绍了Linux:如何设置进程的时区?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要设置在linux上启动的单个进程的时区。我尝试设置 TZ 变量(在本地上下文中),但它不工作。

有从命令行运行应用程序的方法,具有不同的系统日期到系统一?这可能听起来很蠢,但我需要一个沙箱,系统日期将会改变。

启动虚拟框不是一个选项;)

I'd need to set timezones of individual processes started on a linux box. I tried setting TZ variable (in the local context), but it didn't work.
Is there a way of running an app from a command line with a different system date to the system one? It might sound stupid, but I need a kind of a sandbox where the system date would be changed.
Starting a virtual box is not an option ;)

推荐答案

您可能想尝试类似 dateshift libfaketime ,两者都允许您使用偏移时间运行程序。

You might want to try something similar to dateshift or libfaketime, both of which let you run a program with offset time.

这篇关于Linux:如何设置进程的时区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆