32 bool retval = options_mgr.
GetValue(
"CVMFS_DEFAULT_DOMAIN", &result);
35 "Error: could not determine CVMFS_DEFAULT_DOMAIN");
42 if (fqrn.find(
'.') == std::string::npos) {
44 fqrn = fqrn +
"." + default_domain;
54 "CVMFS_WORKSPACE, CVMFS_CACHE_DIR, and CVMFS_CACHE_BASE "
60 if (options_mgr.
GetValue(
"CVMFS_SHARED_CACHE", &optarg) &&
61 options_mgr.
IsOn(optarg))
100 while ((retval = read(fd, &buf, 1)) == 1) {
114 if (!retval)
return false;
118 if (errno == ENOENT) {
120 "Seems like CernVM-FS is not running in %s (not found: %s)",
125 instance_info.
identifier.c_str(), errno, strerror(errno));
130 WritePipe(fd, command.data(), command.size());
136 instance_info.
identifier.c_str(), errno, strerror(errno));
143 static void Usage(
const std::string &exe) {
145 "Usage: %s [-i instance | -p socket] <command> \n"
146 " By default, iterate through all instances defined in \n"
147 " CVMFS_REPOSITORIES \n"
150 " %s -i atlas.cern.ch pid \n"
153 " tracebuffer flush flushes the trace buffer to disk \n"
154 " cache instance describes the active cache manager \n"
155 " cache size gets current size of file cache \n"
156 " cache list gets files in cache \n"
157 " cache list pinned gets pinned file catalogs in cache \n"
158 " cache list catalogs gets all file catalogs in cache \n"
159 " cleanup <MB> cleans file cache until size <= <MB> \n"
160 " cleanup rate <period> n.o. cleanups in the last <period> min \n"
161 " evict <path> removes <path> from the cache \n"
162 " pin <path> pins <path> in the cache \n"
163 " mountpoint returns the mount point \n"
164 " device id returns major:minor virtual device id \n"
165 " on Linux and 0:0 on macOS \n"
166 " remount [sync] look for new catalogs \n"
167 " revision gets the repository revision \n"
168 " max ttl info gets the maximum ttl \n"
169 " max ttl set <minutes> sets the maximum ttl \n"
170 " nameserver get get the DNS server \n"
171 " nameserver set <host> sets a DNS server \n"
172 " host info get host chain and their rtt, \n"
173 " if already probed \n"
174 " host probe orders the host chain according to rtt \n"
175 " host probe geo let Stratum 1s order the host chain and \n"
176 " fallback proxies using the Geo-API \n"
177 " host switch switches to the next host in the chain \n"
178 " host set <host list> sets a new host chain \n"
179 " proxy info gets load-balance proxy groups \n"
180 " proxy rebalance randomly selects a new proxy server \n"
181 " from the current load-balance group \n"
182 " proxy group switch switches to the next load-balance \n"
183 " proxy group in the chain \n"
184 " proxy set <proxy list> sets a new chain of load-balance proxy \n"
185 " groups (not including fallback proxies) \n"
186 " proxy fallback <list> sets a new list of fallback proxies \n"
187 " external host info gets info about external host chain \n"
188 " external host switch switches to the next external host \n"
189 " external host set \n"
190 " <host list> sets external host chain \n"
191 " external proxy info gets info about external proxy groups \n"
192 " external proxy set \n"
193 " <proxy list> sets chain of external proxy groups \n"
194 " timeout info gets the network timeouts \n"
196 " <proxy> <direct> sets the network timeouts in seconds \n"
197 " pid gets the pid \n"
198 " pid cachemgr gets the pid of the shared cache manager \n"
199 " pid watchdog gets the pid of the crash handler process\n"
200 " parameters dumps the effective parameters \n"
201 " reset error counters resets the counter for I/O errors \n"
202 " hotpatch history shows timestamps and version info of \n"
203 " loaded (hotpatched) Fuse modules \n"
204 " version gets cvmfs version \n"
205 " version patchlevel gets cvmfs patchlevel \n"
206 " open catalogs shows information about currently \n"
207 " loaded catalogs (_not_ all cached ones) \n"
208 " latency show the latencies of different fuse \n"
209 " calls (requires CVMFS_INSTRUMENT_FUSE) \n"
211 exe.c_str(), exe.c_str());
215 int main(
int argc,
char *argv[]) {
223 while ((c = getopt(argc, argv,
"+hi:p:")) != -1) {
241 for (; optind < argc; ++optind) {
242 command += argv[optind];
243 if (optind < (argc - 1))
244 command.push_back(
' ');
246 if (command.empty()) {
255 std::string opt_repos;
256 options_mgr.
GetValue(
"CVMFS_REPOSITORIES", &opt_repos);
257 std::vector<std::string> repos =
SplitString(opt_repos,
',');
258 bool is_empty_repo_list =
true;
259 for (
unsigned i = 0; i < repos.size(); ++i) {
260 if (repos[i].empty())
262 is_empty_repo_list =
false;
266 if (!retval) retcode = 1;
268 if (is_empty_repo_list) {
270 "Warning: no instance was specified. In this case, the command "
271 "is executed for all instances defined in CVMFS_REPOSITORIES but"
272 " this list is empty. Did you mean running \n\n"
273 " cvmfs_talk -i <repository name> <command>\n");
277 if (!retval) retcode = 1;
static void Usage(const char *progname)
bool IsOn(const std::string ¶m_value) const
assert((mem||(size==0))&&"Out Of Memory")
void ParseDefault(const std::string &fqrn)
vector< string > SplitString(const string &str, char delim)
std::string instance_name
bool GetValue(const std::string &key, std::string *value) const
int ConnectSocket(const std::string &path)
PathString GetParentPath(const PathString &path)
bool SendCommand(const std::string &command, InstanceInfo instance_info)
void WritePipe(int fd, const void *buf, size_t nbyte)
static bool ReadResponse(int fd)
static std::string GetDefaultDomain()
CVMFS_EXPORT void LogCvmfs(const LogSource source, const int mask, const char *format,...)